From 357631d65939db4a36d868e7fc2fc9f4b5466876 Mon Sep 17 00:00:00 2001 From: Markus Jankowski Date: Mon, 22 Apr 2019 09:30:49 +0200 Subject: [PATCH] Add homematicip cloud temperature sensor from thermostats (#23263) --- .../components/homematicip_cloud/sensor.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/homematicip_cloud/sensor.py b/homeassistant/components/homematicip_cloud/sensor.py index 201a5be6c51..316bf1f4cd8 100644 --- a/homeassistant/components/homematicip_cloud/sensor.py +++ b/homeassistant/components/homematicip_cloud/sensor.py @@ -38,6 +38,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): if isinstance(device, (AsyncHeatingThermostat, AsyncHeatingThermostatCompact)): devices.append(HomematicipHeatingThermostat(home, device)) + devices.append(HomematicipTemperatureSensor(home, device)) if isinstance(device, (AsyncTemperatureHumiditySensorDisplay, AsyncTemperatureHumiditySensorWithoutDisplay, AsyncTemperatureHumiditySensorOutdoor, @@ -46,15 +47,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities): AsyncWeatherSensorPro)): devices.append(HomematicipTemperatureSensor(home, device)) devices.append(HomematicipHumiditySensor(home, device)) - if isinstance(device, (AsyncMotionDetectorIndoor, + if isinstance(device, (AsyncLightSensor, AsyncMotionDetectorIndoor, AsyncMotionDetectorOutdoor, AsyncMotionDetectorPushButton, AsyncWeatherSensor, AsyncWeatherSensorPlus, AsyncWeatherSensorPro)): devices.append(HomematicipIlluminanceSensor(home, device)) - if isinstance(device, AsyncLightSensor): - devices.append(HomematicipLightSensor(home, device)) if isinstance(device, (AsyncPlugableSwitchMeasuring, AsyncBrandSwitchMeasuring, AsyncFullFlushSwitchMeasuring)): @@ -181,6 +180,9 @@ class HomematicipTemperatureSensor(HomematicipGenericDevice): @property def state(self): """Return the state.""" + if hasattr(self._device, 'valveActualTemperature'): + return self._device.valveActualTemperature + return self._device.actualTemperature @property @@ -213,6 +215,9 @@ class HomematicipIlluminanceSensor(HomematicipGenericDevice): @property def state(self): """Return the state.""" + if hasattr(self._device, 'averageIllumination'): + return self._device.averageIllumination + return self._device.illumination @property @@ -221,15 +226,6 @@ class HomematicipIlluminanceSensor(HomematicipGenericDevice): return 'lx' -class HomematicipLightSensor(HomematicipIlluminanceSensor): - """Represenation of a HomematicIP Illuminance device.""" - - @property - def state(self): - """Return the state.""" - return self._device.averageIllumination - - class HomematicipPowerSensor(HomematicipGenericDevice): """Represenation of a HomematicIP power measuring device."""