Add support for Somfy RTS power socket and Somfy io Temperature sensor (#30053)

* Added support for Somfy RTS wireless power socket and
Somfy Temperature Sensore Thermos Wirefree io

* Added code formatting fixes for commit 5faaf9c

* added support for RollerShutterRTSComponent from Somfy

* Added support for RTS roller shutter in set_cover_position

* Add support for Somfy RTS power socket and Somfy io temperature sensor

* black and isort fixes
This commit is contained in:
rhadamantys 2019-12-31 14:48:31 +01:00 committed by springstan
parent b0a0871bed
commit dedd1aec8c
3 changed files with 18 additions and 6 deletions

View File

@ -45,6 +45,7 @@ TAHOMA_TYPES = {
"io:RollerShutterWithLowSpeedManagementIOComponent": "cover",
"io:SomfyBasicContactIOSystemSensor": "sensor",
"io:SomfyContactIOSystemSensor": "sensor",
"io:TemperatureIOSystemSensor": "sensor",
"io:VerticalExteriorAwningIOComponent": "cover",
"io:VerticalInteriorBlindVeluxIOComponent": "cover",
"io:WindowOpenerVeluxIOComponent": "cover",
@ -59,6 +60,7 @@ TAHOMA_TYPES = {
"rts:ExteriorVenetianBlindRTSComponent": "cover",
"rts:GarageDoor4TRTSComponent": "switch",
"rts:RollerShutterRTSComponent": "cover",
"rts:OnOffRTSComponent": "switch",
"rts:VenetianBlindRTSComponent": "cover",
}

View File

@ -2,7 +2,7 @@
from datetime import timedelta
import logging
from homeassistant.const import ATTR_BATTERY_LEVEL
from homeassistant.const import ATTR_BATTERY_LEVEL, TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice
@ -40,8 +40,8 @@ class TahomaSensor(TahomaDevice, Entity):
@property
def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
if self.tahoma_device.type == "Temperature Sensor":
return None
if self.tahoma_device.type == "io:TemperatureIOSystemSensor":
return TEMP_CELSIUS
if self.tahoma_device.type == "io:SomfyContactIOSystemSensor":
return None
if self.tahoma_device.type == "io:SomfyBasicContactIOSystemSensor":
@ -79,6 +79,11 @@ class TahomaSensor(TahomaDevice, Entity):
if self.tahoma_device.type == "rtds:RTDSMotionSensor":
self.current_value = self.tahoma_device.active_states["core:OccupancyState"]
self._available = True
if self.tahoma_device.type == "io:TemperatureIOSystemSensor":
self.current_value = round(
float(self.tahoma_device.active_states["core:TemperatureState"]), 1
)
self._available = True
_LOGGER.debug("Update %s, value: %d", self._name, self.current_value)

View File

@ -45,9 +45,14 @@ class TahomaSwitch(TahomaDevice, SwitchDevice):
else:
self._state = STATE_OFF
self._available = bool(
self.tahoma_device.active_states.get("core:StatusState") == "available"
)
# A RTS power socket doesn't have a feedback channel,
# so we must assume the socket is available.
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)