From 935665bd5ba52cc662caeb94c8afc6bd747ad2ad Mon Sep 17 00:00:00 2001 From: coreGreenberet Date: Mon, 5 Apr 2021 16:34:00 +0200 Subject: [PATCH] added HmIP-STE2-PCB closes #386 --- CHANGELOG.md | 6 ++ homematicip.pyproj | 2 +- homematicip/aio/class_maps.py | 1 + homematicip/aio/device.py | 3 + homematicip/base/enums.py | 2 + homematicip/base/functionalChannels.py | 17 +++++ homematicip/class_maps.py | 2 + homematicip/device.py | 25 +++++++- homematicip_demo/json_data/home.json | 88 ++++++++++++++++++++++++++ tests/test_devices.py | 13 ++++ 10 files changed, 156 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7cdfb63..70b03e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### ADDED +- API +- Devices + - [HmIP-STE2-PCB] (Temperature Difference Sensors - 2x sensors) + ## [0.13.1] 2021-01-23 ### ADDED @@ -420,4 +425,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [HMIP-SRD]: https://github.com/coreGreenberet/homematicip-rest-api/issues/375 [HMIP-WRCC2]: https://github.com/coreGreenberet/homematicip-rest-api/issues/373 [HMIP-DRSI1]: https://github.com/coreGreenberet/homematicip-rest-api/issues/373 +[HmIP-STE2-PCB]: https://github.com/coreGreenberet/homematicip-rest-api/issues/386 [activate_absence_permanent]: https://github.com/coreGreenberet/homematicip-rest-api/issues/357 diff --git a/homematicip.pyproj b/homematicip.pyproj index 63793c1f..7af12271 100644 --- a/homematicip.pyproj +++ b/homematicip.pyproj @@ -17,7 +17,7 @@ False - --dump-configuration + --dump-configuration --config-file homematicip_demo/json_data/home.json MSBuild|venv|$(MSBuildProjectFullPath) true pytest diff --git a/homematicip/aio/class_maps.py b/homematicip/aio/class_maps.py index befedf6f..668d2902 100644 --- a/homematicip/aio/class_maps.py +++ b/homematicip/aio/class_maps.py @@ -68,6 +68,7 @@ DeviceType.TEMPERATURE_HUMIDITY_SENSOR: AsyncTemperatureHumiditySensorWithoutDisplay, DeviceType.TEMPERATURE_HUMIDITY_SENSOR_DISPLAY: AsyncTemperatureHumiditySensorDisplay, DeviceType.TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR: AsyncTemperatureHumiditySensorOutdoor, + DeviceType.TEMPERATURE_SENSOR_2_EXTERNAL_DELTA: AsyncTemperaturDifferenceSensor2, DeviceType.TILT_VIBRATION_SENSOR: AsyncTiltVibrationSensor, DeviceType.TORMATIC_MODULE: AsyncGarageDoorModuleTormatic, DeviceType.WALL_MOUNTED_THERMOSTAT_BASIC_HUMIDITY: AsyncWallMountedThermostatBasicHumidity, diff --git a/homematicip/aio/device.py b/homematicip/aio/device.py index bb8529ac..0d39bce1 100644 --- a/homematicip/aio/device.py +++ b/homematicip/aio/device.py @@ -578,3 +578,6 @@ async def stop(self): class AsyncRainSensor(RainSensor, AsyncDevice): """ HMIP-SRD (Rain Sensor) """ + +class AsyncTemperaturDifferenceSensor2(TemperaturDifferenceSensor2, AsyncDevice): + """ HmIP-STE2-PCB (Temperature Difference Sensors - 2x sensors) """ \ No newline at end of file diff --git a/homematicip/base/enums.py b/homematicip/base/enums.py index 2f2279e0..8436071f 100644 --- a/homematicip/base/enums.py +++ b/homematicip/base/enums.py @@ -262,6 +262,7 @@ class DeviceType(AutoNameEnum): TEMPERATURE_HUMIDITY_SENSOR = auto() TEMPERATURE_HUMIDITY_SENSOR_DISPLAY = auto() TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR = auto() + TEMPERATURE_SENSOR_2_EXTERNAL_DELTA = auto() TILT_VIBRATION_SENSOR = auto() TORMATIC_MODULE = auto() WALL_MOUNTED_THERMOSTAT_BASIC_HUMIDITY = auto() @@ -436,6 +437,7 @@ class FunctionalChannelType(AutoNameEnum): SMOKE_DETECTOR_CHANNEL = auto() SWITCH_CHANNEL = auto() SWITCH_MEASURING_CHANNEL = auto() + TEMPERATURE_SENSOR_2_EXTERNAL_DELTA_CHANNEL = auto() TILT_VIBRATION_SENSOR_CHANNEL = auto() WALL_MOUNTED_THERMOSTAT_PRO_CHANNEL = auto() WALL_MOUNTED_THERMOSTAT_WITHOUT_DISPLAY_CHANNEL = auto() diff --git a/homematicip/base/functionalChannels.py b/homematicip/base/functionalChannels.py index a4ef2213..2751b4ea 100644 --- a/homematicip/base/functionalChannels.py +++ b/homematicip/base/functionalChannels.py @@ -996,3 +996,20 @@ def from_json(self, js, groups: Iterable[Group]): super().from_json(js, groups) self.set_attr_from_dict("rainSensorSensitivity", js) self.set_attr_from_dict("raining", js) + +class TemperaturDifferenceSensor2Channel(FunctionalChannel): + """ this is the representative of the TEMPERATURE_SENSOR_2_EXTERNAL_DELTA_CHANNEL channel """ + + def __init__(self, connection): + super().__init__(connection) + #:float: + self.temperatureExternalDelta = 0.0 + #:float: + self.temperatureExternalOne = 0.0 + #:float: + self.temperatureExternalTwo = 0.0 + def from_json(self, js, groups: Iterable[Group]): + super().from_json(js, groups) + self.set_attr_from_dict("temperatureExternalDelta", js) + self.set_attr_from_dict("temperatureExternalOne", js) + self.set_attr_from_dict("temperatureExternalTwo", js) \ No newline at end of file diff --git a/homematicip/class_maps.py b/homematicip/class_maps.py index 5fc25b7e..894e506f 100644 --- a/homematicip/class_maps.py +++ b/homematicip/class_maps.py @@ -71,6 +71,7 @@ DeviceType.TEMPERATURE_HUMIDITY_SENSOR: TemperatureHumiditySensorWithoutDisplay, DeviceType.TEMPERATURE_HUMIDITY_SENSOR_DISPLAY: TemperatureHumiditySensorDisplay, DeviceType.TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR: TemperatureHumiditySensorOutdoor, + DeviceType.TEMPERATURE_SENSOR_2_EXTERNAL_DELTA: TemperaturDifferenceSensor2, DeviceType.TILT_VIBRATION_SENSOR: TiltVibrationSensor, DeviceType.TORMATIC_MODULE: GarageDoorModuleTormatic, DeviceType.WALL_MOUNTED_THERMOSTAT_PRO: WallMountedThermostatPro, @@ -189,6 +190,7 @@ FunctionalChannelType.SMOKE_DETECTOR_CHANNEL: SmokeDetectorChannel, FunctionalChannelType.SWITCH_CHANNEL: SwitchChannel, FunctionalChannelType.SWITCH_MEASURING_CHANNEL: SwitchMeasuringChannel, + FunctionalChannelType.TEMPERATURE_SENSOR_2_EXTERNAL_DELTA_CHANNEL: TemperaturDifferenceSensor2Channel, FunctionalChannelType.TILT_VIBRATION_SENSOR_CHANNEL: TiltVibrationSensorChannel, FunctionalChannelType.WALL_MOUNTED_THERMOSTAT_PRO_CHANNEL: WallMountedThermostatProChannel, FunctionalChannelType.WALL_MOUNTED_THERMOSTAT_WITHOUT_DISPLAY_CHANNEL: WallMountedThermostatWithoutDisplayChannel, diff --git a/homematicip/device.py b/homematicip/device.py index ecc8f0c9..77e498d4 100644 --- a/homematicip/device.py +++ b/homematicip/device.py @@ -2052,9 +2052,9 @@ class RainSensor(Device): def __init__(self, connection): super().__init__(connection) - #:float: - self.raining = False #:bool: + self.raining = False + #:float: self.rainSensorSensitivity = 0.0 def from_json(self, js): @@ -2063,3 +2063,24 @@ def from_json(self, js): if c: self.set_attr_from_dict("rainSensorSensitivity", c) self.set_attr_from_dict("raining", c) + + +class TemperaturDifferenceSensor2(Device): + """ HmIP-STE2-PCB (Temperature Difference Sensors - 2x sensors) """ + + def __init__(self, connection): + super().__init__(connection) + #:float: + self.temperatureExternalDelta = 0.0 + #:float: + self.temperatureExternalOne = 0.0 + #:float: + self.temperatureExternalTwo = 0.0 + + def from_json(self, js): + super().from_json(js) + c = get_functional_channel("TEMPERATURE_SENSOR_2_EXTERNAL_DELTA_CHANNEL", js) + if c: + self.set_attr_from_dict("temperatureExternalDelta", c) + self.set_attr_from_dict("temperatureExternalOne", c) + self.set_attr_from_dict("temperatureExternalTwo", c) \ No newline at end of file diff --git a/homematicip_demo/json_data/home.json b/homematicip_demo/json_data/home.json index 8c86a683..221922d5 100644 --- a/homematicip_demo/json_data/home.json +++ b/homematicip_demo/json_data/home.json @@ -1487,6 +1487,94 @@ "type": "FULL_FLUSH_INPUT_SWITCH", "updateState": "UP_TO_DATE" }, + "3014F711000HmIP-STE2-PCB": { + "availableFirmwareVersion": "0.0.0", + "connectionType": "HMIP_RF", + "firmwareVersion": "1.0.18", + "firmwareVersionInteger": 65554, + "functionalChannels": { + "0": { + "busConfigMismatch": null, + "coProFaulty": false, + "coProRestartNeeded": false, + "coProUpdateFailure": false, + "configPending": false, + "deviceId": "3014F711000HmIP-STE2-PCB", + "deviceOverheated": false, + "deviceOverloaded": false, + "devicePowerFailureDetected": false, + "deviceUndervoltage": false, + "dutyCycle": false, + "functionalChannelType": "DEVICE_BASE", + "groupIndex": 0, + "groups": [], + "index": 0, + "label": "", + "lowBat": false, + "mountingOrientation": null, + "multicastRoutingEnabled": false, + "particulateMatterSensorCommunicationError": null, + "particulateMatterSensorError": null, + "powerShortCircuit": null, + "routerModuleEnabled": false, + "routerModuleSupported": false, + "rssiDeviceValue": -61, + "rssiPeerValue": null, + "shortCircuitDataLine": null, + "supportedOptionalFeatures": { + "IFeatureBusConfigMismatch": false, + "IFeatureDeviceCoProError": false, + "IFeatureDeviceCoProRestart": false, + "IFeatureDeviceCoProUpdate": false, + "IFeatureDeviceIdentify": false, + "IFeatureDeviceOverheated": false, + "IFeatureDeviceOverloaded": false, + "IFeatureDeviceParticulateMatterSensorCommunicationError": false, + "IFeatureDeviceParticulateMatterSensorError": false, + "IFeatureDevicePowerFailure": false, + "IFeatureDeviceTemperatureHumiditySensorCommunicationError": false, + "IFeatureDeviceTemperatureHumiditySensorError": false, + "IFeatureDeviceTemperatureOutOfRange": false, + "IFeatureDeviceUndervoltage": false, + "IFeatureMulticastRouter": false, + "IFeaturePowerShortCircuit": false, + "IFeatureRssiValue": true, + "IFeatureShortCircuitDataLine": false, + "IOptionalFeatureDutyCycle": true, + "IOptionalFeatureLowBat": true, + "IOptionalFeatureMountingOrientation": false + }, + "temperatureHumiditySensorCommunicationError": null, + "temperatureHumiditySensorError": null, + "temperatureOutOfRange": false, + "unreach": false + }, + "1": { + "deviceId": "3014F711000HmIP-STE2-PCB", + "functionalChannelType": "TEMPERATURE_SENSOR_2_EXTERNAL_DELTA_CHANNEL", + "groupIndex": 1, + "groups": [], + "index": 1, + "label": "", + "temperatureExternalDelta": -0.3, + "temperatureExternalOne": 37.8, + "temperatureExternalTwo": 38.1 + } + }, + "homeId": "00000000-0000-0000-0000-000000000001", + "id": "3014F711000HmIP-STE2-PCB", + "label": "Temperatursensor Speicher", + "lastStatusUpdate": 1613049207162, + "liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED", + "manufacturerCode": 1, + "modelId": 415, + "modelType": "HmIP-STE2-PCB", + "oem": "eQ-3", + "permanentlyReachable": false, + "serializedGlobalTradeItemNumber": "3014F711000HmIP-STE2-PCB", + "type": "TEMPERATURE_SENSOR_2_EXTERNAL_DELTA", + "updateState": "UP_TO_DATE" + }, "3014F7110000000HOERMANN": { "availableFirmwareVersion": "0.0.0", "connectionType": "HMIP_RF", diff --git a/tests/test_devices.py b/tests/test_devices.py index cabf51dd..566619c8 100644 --- a/tests/test_devices.py +++ b/tests/test_devices.py @@ -1367,3 +1367,16 @@ def test_din_rail_switch(fake_home: Home): "profileMode(None) userDesiredProfileMode(AUTOMATIC) on(None) profileMode(None) " "userDesiredProfileMode(AUTOMATIC)" ) + +def test_temperatur_sensor_2_delta(fake_home: Home): + d = fake_home.search_device_by_id("3014F711000HmIP-STE2-PCB") + assert isinstance(d, TemperaturDifferenceSensor2) + assert d.temperatureExternalDelta == -0.3 + assert d.temperatureExternalOne == 37.8 + assert d.temperatureExternalTwo == 38.1 + + assert str(d) == ( + "HmIP-STE2-PCB Temperatursensor Speicher lowBat(False) unreach(False) " + "rssiDeviceValue(-61) rssiPeerValue(None) configPending(False) dutyCycle(False) " + "temperatureExternalDelta(-0.3) temperatureExternalOne(37.8) temperatureExternalTwo(38.1)" + ) \ No newline at end of file