From 99af1f148b48a43e1be4255ab7aecaea1ba8f902 Mon Sep 17 00:00:00 2001 From: maxm87 Date: Tue, 10 Jul 2018 23:56:16 +0200 Subject: [PATCH 1/2] Update sensors.py - added SmartwareMotion Detector Update sensors.py - added SmartwareMotion Detector (433 MHz) --- pyhomematic/devicetypes/sensors.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pyhomematic/devicetypes/sensors.py b/pyhomematic/devicetypes/sensors.py index 566237ebf..7ddcac16d 100644 --- a/pyhomematic/devicetypes/sensors.py +++ b/pyhomematic/devicetypes/sensors.py @@ -260,6 +260,25 @@ def is_motion(self, channel=None): def get_brightness(self, channel=None): """ Return brightness from 0 (dark ) to 255 (bright) """ return int(self.getSensorData("BRIGHTNESS", channel)) + + +class SmartwareMotion(HMBinarySensor, HMSensor): + """Motion detection.""" + + def __init__(self, device_description, proxy, resolveparamsets=False): + super().__init__(device_description, proxy, resolveparamsets) + + # init metadata + self.BINARYNODE.update({"STATE": self.ELEMENT}) + #self.BINARYNODE.update({"STATE": [1]}) + + def is_motion(self, channel=None): + """ Return True if motion is detected """ + return bool(self.getBinaryData("STATE", channel)) + + @property + def ELEMENT(self): + return [1] class MotionV2(Motion, HelperSabotage): @@ -684,4 +703,5 @@ def get_air_pressure(self, channel=None): "HmIP-STHO": IPAreaThermostat, "HmIP-STHO-A": IPAreaThermostat, "HmIP-SPDR": IPPassageSensor, + "IT-Old-Remote-1-Channel": SmartwareMotion, } From f56614e0248cfef82797bfd106b2c67b2a73dd69 Mon Sep 17 00:00:00 2001 From: Daniel Perna Date: Sat, 14 Jul 2018 20:19:48 +0200 Subject: [PATCH 2/2] Update sensors.py --- pyhomematic/devicetypes/sensors.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyhomematic/devicetypes/sensors.py b/pyhomematic/devicetypes/sensors.py index 7ddcac16d..ec2366d32 100644 --- a/pyhomematic/devicetypes/sensors.py +++ b/pyhomematic/devicetypes/sensors.py @@ -260,8 +260,8 @@ def is_motion(self, channel=None): def get_brightness(self, channel=None): """ Return brightness from 0 (dark ) to 255 (bright) """ return int(self.getSensorData("BRIGHTNESS", channel)) - - + + class SmartwareMotion(HMBinarySensor, HMSensor): """Motion detection.""" @@ -270,7 +270,6 @@ def __init__(self, device_description, proxy, resolveparamsets=False): # init metadata self.BINARYNODE.update({"STATE": self.ELEMENT}) - #self.BINARYNODE.update({"STATE": [1]}) def is_motion(self, channel=None): """ Return True if motion is detected """ @@ -278,7 +277,7 @@ def is_motion(self, channel=None): @property def ELEMENT(self): - return [1] + return [1] class MotionV2(Motion, HelperSabotage):