Added support for Somfy RTS wireless power socket and

Somfy Temperature Sensore Thermos Wirefree io
pull/20245/head
matthias 2019-01-19 14:26:30 +01:00
parent 440d479be8
commit 5faaf9c6d2
3 changed files with 18 additions and 6 deletions

View File

@ -48,8 +48,8 @@ class TahomaSensor(TahomaDevice, Entity):
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any.""" """Return the unit of measurement of this entity, if any."""
if self.tahoma_device.type == 'Temperature Sensor': if self.tahoma_device.type == 'io:TemperatureIOSystemSensor':
return None return '°C'
if self.tahoma_device.type == 'io:SomfyContactIOSystemSensor': if self.tahoma_device.type == 'io:SomfyContactIOSystemSensor':
return None return None
if self.tahoma_device.type == 'io:LightIOSystemSensor': if self.tahoma_device.type == 'io:LightIOSystemSensor':
@ -82,6 +82,11 @@ class TahomaSensor(TahomaDevice, Entity):
self.current_value = self.tahoma_device.active_states[ self.current_value = self.tahoma_device.active_states[
'core:OccupancyState'] 'core:OccupancyState']
self._available = True self._available = True
if self.tahoma_device.type == 'io:TemperatureIOSystemSensor':
""" round the temperature value, otherwise, it will show up as 13.4999999999999 """
self.current_value = float("{:.2f}".format(self.tahoma_device.active_states[
'core:TemperatureState']))
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)

View File

@ -54,9 +54,14 @@ class TahomaSwitch(TahomaDevice, SwitchDevice):
self._state = STATE_ON self._state = STATE_ON
else: else:
self._state = STATE_OFF self._state = STATE_OFF
self._available = bool(self.tahoma_device.active_states.get( """ A RTS power socket doesn't have a feedback channel, so we must assume the
'core:StatusState') == 'available') socket is available. If not, the signal is lost in the endless expanse of the universe """
if self.tahoma_device.type == 'rts:OnOffRTSComponent':
self._available = True
else:
self._available = bool(self.tahoma_device.active_states.get(
'core:StatusState') == 'available')
_LOGGER.debug("Update %s, state: %s", self._name, self._state) _LOGGER.debug("Update %s, state: %s", self._name, self._state)

View File

@ -39,6 +39,7 @@ TAHOMA_TYPES = {
'io:ExteriorVenetianBlindIOComponent': 'cover', 'io:ExteriorVenetianBlindIOComponent': 'cover',
'io:HorizontalAwningIOComponent': 'cover', 'io:HorizontalAwningIOComponent': 'cover',
'io:LightIOSystemSensor': 'sensor', 'io:LightIOSystemSensor': 'sensor',
'io:TemperatureIOSystemSensor': 'sensor',
'io:OnOffIOComponent': 'switch', 'io:OnOffIOComponent': 'switch',
'io:OnOffLightIOComponent': 'switch', 'io:OnOffLightIOComponent': 'switch',
'io:RollerShutterGenericIOComponent': 'cover', 'io:RollerShutterGenericIOComponent': 'cover',
@ -57,7 +58,8 @@ TAHOMA_TYPES = {
'rts:ExteriorVenetianBlindRTSComponent': 'cover', 'rts:ExteriorVenetianBlindRTSComponent': 'cover',
'rts:GarageDoor4TRTSComponent': 'switch', 'rts:GarageDoor4TRTSComponent': 'switch',
'rts:RollerShutterRTSComponent': 'cover', 'rts:RollerShutterRTSComponent': 'cover',
'rts:VenetianBlindRTSComponent': 'cover' 'rts:VenetianBlindRTSComponent': 'cover',
'rts:OnOffRTSComponent': 'switch'
} }