From 9c1a539f904ad81d815dc633739342af14214566 Mon Sep 17 00:00:00 2001 From: christopheBfr <43133099+christopheBfr@users.noreply.github.com> Date: Fri, 14 Sep 2018 21:31:08 +0200 Subject: [PATCH] =?UTF-8?q?Adding=20support=20for=20RTDSContactSensor=20an?= =?UTF-8?q?d=20RTDSMotionSensor=20in=20Tahoma=20=E2=80=A6=20(RTS=20Alarms?= =?UTF-8?q?=20sensors=20and=20contacts=20for=20Somfy=20Protexiom=20alarms)?= =?UTF-8?q?=20(#16609)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding support for RTDSContactSensor and RTDSContactSensor in Tahoma component * Removing extra blank lines --- homeassistant/components/sensor/tahoma.py | 19 ++++++++++++++++--- homeassistant/components/tahoma.py | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/tahoma.py b/homeassistant/components/sensor/tahoma.py index a59eb705498..5918bd7c9f8 100644 --- a/homeassistant/components/sensor/tahoma.py +++ b/homeassistant/components/sensor/tahoma.py @@ -56,6 +56,10 @@ class TahomaSensor(TahomaDevice, Entity): return 'lx' if self.tahoma_device.type == 'Humidity Sensor': return '%' + if self.tahoma_device.type == 'rtds:RTDSContactSensor': + return None + if self.tahoma_device.type == 'rtds:RTDSMotionSensor': + return None def update(self): """Update the state.""" @@ -63,12 +67,21 @@ class TahomaSensor(TahomaDevice, Entity): if self.tahoma_device.type == 'io:LightIOSystemSensor': self.current_value = self.tahoma_device.active_states[ 'core:LuminanceState'] + self._available = bool(self.tahoma_device.active_states.get( + 'core:StatusState') == 'available') if self.tahoma_device.type == 'io:SomfyContactIOSystemSensor': self.current_value = self.tahoma_device.active_states[ 'core:ContactState'] - - self._available = bool(self.tahoma_device.active_states.get( - 'core:StatusState') == 'available') + self._available = bool(self.tahoma_device.active_states.get( + 'core:StatusState') == 'available') + if self.tahoma_device.type == 'rtds:RTDSContactSensor': + self.current_value = self.tahoma_device.active_states[ + 'core:ContactState'] + self._available = True + if self.tahoma_device.type == 'rtds:RTDSMotionSensor': + self.current_value = self.tahoma_device.active_states[ + 'core:OccupancyState'] + self._available = True _LOGGER.debug("Update %s, value: %d", self._name, self.current_value) diff --git a/homeassistant/components/tahoma.py b/homeassistant/components/tahoma.py index 64071ddb037..366799b872c 100644 --- a/homeassistant/components/tahoma.py +++ b/homeassistant/components/tahoma.py @@ -54,6 +54,8 @@ TAHOMA_TYPES = { 'io:HorizontalAwningIOComponent': 'cover', 'io:OnOffLightIOComponent': 'switch', 'rtds:RTDSSmokeSensor': 'smoke', + 'rtds:RTDSContactSensor': 'sensor', + 'rtds:RTDSMotionSensor': 'sensor' } -- GitLab