Add more tahoma sensors (#36256)

This commit is contained in:
Vincent Le Bourlot 2020-06-03 03:17:55 +02:00 committed by GitHub
parent b5f12bd9c1
commit 7e2872bab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -66,6 +66,8 @@ TAHOMA_TYPES = {
"rts:RollerShutterRTSComponent": "cover", "rts:RollerShutterRTSComponent": "cover",
"rts:OnOffRTSComponent": "switch", "rts:OnOffRTSComponent": "switch",
"rts:VenetianBlindRTSComponent": "cover", "rts:VenetianBlindRTSComponent": "cover",
"somfythermostat:SomfyThermostatTemperatureSensor": "sensor",
"somfythermostat:SomfyThermostatHumiditySensor": "sensor",
} }

View File

@ -56,6 +56,13 @@ class TahomaSensor(TahomaDevice, Entity):
return None return None
if self.tahoma_device.type == "rtds:RTDSMotionSensor": if self.tahoma_device.type == "rtds:RTDSMotionSensor":
return None return None
if (
self.tahoma_device.type
== "somfythermostat:SomfyThermostatTemperatureSensor"
):
return TEMP_CELSIUS
if self.tahoma_device.type == "somfythermostat:SomfyThermostatHumiditySensor":
return UNIT_PERCENTAGE
def update(self): def update(self):
"""Update the state.""" """Update the state."""
@ -86,6 +93,19 @@ class TahomaSensor(TahomaDevice, Entity):
float(self.tahoma_device.active_states["core:TemperatureState"]), 1 float(self.tahoma_device.active_states["core:TemperatureState"]), 1
) )
self._available = True self._available = True
if (
self.tahoma_device.type
== "somfythermostat:SomfyThermostatTemperatureSensor"
):
self.current_value = float(
f"{self.tahoma_device.active_states['core:TemperatureState']:.2f}"
)
self._available = True
if self.tahoma_device.type == "somfythermostat:SomfyThermostatHumiditySensor":
self.current_value = float(
f"{self.tahoma_device.active_states['core:RelativeHumidityState']:.2f}"
)
self._available = True
_LOGGER.debug("Update %s, value: %d", self._name, self.current_value) _LOGGER.debug("Update %s, value: %d", self._name, self.current_value)