From 899a28c6036ea799cfb5513a65e37135556c60a7 Mon Sep 17 00:00:00 2001 From: Daniel Perna Date: Mon, 10 Jan 2022 00:33:28 +0100 Subject: [PATCH] 0.1.77 (#456) * Bump version * Add new HMIP Evo (HmIP-eTRV-E) (#434) * Add device support for HmIP-WHS2 (#436) * Update changelog * Add device support for HmIP-SFD (#441) Fixes #438 * Add HmIP-WRCR #390 * Add device support for "new" version of HmIP-SMI55 (#447) Fixes #445 (cherry picked from commit 50582dc45a900ba85b4d87bc7a4deee538cbdbc3) * Update changelog * Bump version * Reduce log level for events * Add HB-RC-12-EP-C #450 * Update README.rst (#451) * Add HmIP-SMO-2 * HmIP-SPI * Add HmIPW-SMI55 #452 * Add HmIPW-WRC6 #452 * Final changelog Co-authored-by: emufan Co-authored-by: wutr <13820537+wutr@users.noreply.github.com> Co-authored-by: Timo Co-authored-by: SukramJ --- README.rst | 2 +- changelog.txt | 9 ++++ pyhomematic/devicetypes/generic.py | 2 +- pyhomematic/devicetypes/misc.py | 13 +++++- pyhomematic/devicetypes/sensors.py | 69 +++++++++++++++++++++++++++--- setup.py | 2 +- 6 files changed, 88 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index dffe730ff..fc3f71d98 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ pyhomematic Python 3 Interface to interact with Homematic devices. -Important: This project will be deprecated in favor of https://github.com/danielperna84/hahomematic at some point in the future. A custom component to work with hahomematic can be found here: https://github.com/danielperna84/custom_homematic. It is however not usable yet. Feel free to contribute! +Important: This project will be deprecated in favor of https://github.com/danielperna84/hahomematic at some point in the future. A custom component to work with hahomematic can be found here: https://github.com/danielperna84/custom_homematic. Feel free to contribute! This library provides easy (bi-directional) control of Homematic devices hooked up to a regular CCU or Homegear. The focus is to be able to receive events. If you are only interested in actively controlling devices, you can use the Python-built-in xmlrpc.client.ServerProxy (Python 3). See pyhomematic._server.ServerThread.connect on how to connect to a CCU / Homegear as a client. diff --git a/changelog.txt b/changelog.txt index 478922d77..a42206ebd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,12 @@ +Version 0.1.77 (2022-01-10) +- Add HmIP-WRCR @danielperna84 +- Add HmIP-SMI55-2 @hzpz +- Add HB-RC-12-EP-C @danielperna84 +- Add HmIP-SMO-2 (Issue #453) @danielperna84 +- Add Sensors for HmIP-SPI @danielperna84 +- Add HmIPW-SMI55 & HmIPW-WRC6 (Issue #452) @danielperna84 +- Reduce loglevel for events + Version 0.1.76 (2021-10-20) - Add HmIP-WHS2 @wutr - Add HmIP-eTRV-E @emufan diff --git a/pyhomematic/devicetypes/generic.py b/pyhomematic/devicetypes/generic.py index 8c7e2c2ac..eb95162e5 100644 --- a/pyhomematic/devicetypes/generic.py +++ b/pyhomematic/devicetypes/generic.py @@ -55,7 +55,7 @@ def event(self, interface_id, key, value): """ Handle the event received by server. """ - LOG.info( + LOG.debug( "HMGeneric.event: address=%s, interface_id=%s, key=%s, value=%s" % (self._ADDRESS, interface_id, key, value)) diff --git a/pyhomematic/devicetypes/misc.py b/pyhomematic/devicetypes/misc.py index 16c6eaeda..24c8a7973 100644 --- a/pyhomematic/devicetypes/misc.py +++ b/pyhomematic/devicetypes/misc.py @@ -58,10 +58,18 @@ def ELEMENT(self): return [1, 2, 3, 4, 5, 6, 7, 8] if "HmIP-MOD-RC8" in self.TYPE: return [1, 2, 3, 4, 5, 6, 7, 8] - if "HmIP-WRCD" in self.TYPE: + if "HmIP-WRCD" in self.TYPE or "HmIP-WRCR" in self.TYPE: return [1, 2, 3] return [1] +class RemoteWired(HMEvent, HelperEventRemote, HelperActionPress): + """Wired Remote handle buttons.""" + + @property + def ELEMENT(self): + if "WRC6" in self.TYPE: + return [1, 2, 3, 4, 5, 6] + class RemoteBatteryIP(Remote, HelperLowBatIP, HelperOperatingVoltageIP): """Battery operated HomeMaticIP remote device.""" @@ -96,6 +104,7 @@ def ELEMENT(self): "HM-RC-4-2": RemoteBattery, "HM-RC-4-3": RemoteBattery, "HM-RC-4-3-D": RemoteBattery, + "HB-RC-12-EP-C": RemoteBattery, "HM-RC-8": Remote, "HM-RC-12": Remote, "HM-RC-12-B": Remote, @@ -143,7 +152,9 @@ def ELEMENT(self): "HmIP-WRCC2": RemoteBatteryIP, "HmIP-BRC2": Remote, "HmIP-WRC6": RemoteBatteryIP, + "HmIPW-WRC6": RemoteWired, "HmIP-WRCD": RemoteBatteryIP, + "HmIP-WRCR": RemoteBatteryIP, "HmIP-KRCA": RemoteBatteryIP, "HmIP-KRC4": RemoteBatteryIP, "HM-SwI-3-FM": RemotePress, diff --git a/pyhomematic/devicetypes/sensors.py b/pyhomematic/devicetypes/sensors.py index 51a3eda26..62580fb16 100644 --- a/pyhomematic/devicetypes/sensors.py +++ b/pyhomematic/devicetypes/sensors.py @@ -209,6 +209,21 @@ def __init__(self, device_description, proxy, resolveparamsets=False): "ACTUAL_TEMPERATURE": [4] }) +class ParticulateMatterSensorIP(SensorHmIPNoBattery): + """Particulate matter sensor""" + + def __init__(self, device_description, proxy, resolveparamsets=False): + super().__init__(device_description, proxy, resolveparamsets) + self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [1], + "HUMIDITY": [1], + "MASS_CONCENTRATION_PM_1": [1], + "MASS_CONCENTRATION_PM_2_5": [1], + "MASS_CONCENTRATION_PM_10": [1], + "MASS_CONCENTRATION_PM_1_24H_AVERAGE": [1], + "MASS_CONCENTRATION_PM_2_5_24H_AVERAGE": [1], + "MASS_CONCENTRATION_PM_10_24H_AVERAGE": [1] + }) + class WaterSensor(SensorHm, HelperSensorState): """Watter detect sensor.""" @@ -490,8 +505,8 @@ def get_brightness(self, channel=None): @property def ELEMENT(self): - return [0, 1] - + return [0, 1] + class MotionIPV2(SensorHmIP): """Motion detection indoor 55 (rf ip) @@ -521,6 +536,34 @@ def ELEMENT(self): return [0, 1, 2, 3] +class MotionIPV2W(SensorHmIPW): + """Motion detection indoor 55 (rf ip) + This is a binary sensor.""" + + def __init__(self, device_description, proxy, resolveparamsets=False): + super().__init__(device_description, proxy, resolveparamsets) + + # init metadata + self.BINARYNODE.update({"MOTION_DETECTION_ACTIVE": [3], "MOTION": [3]}) + self.SENSORNODE.update({"ILLUMINATION": [3]}) + self.ATTRIBUTENODE.update({"ERROR_CODE": [0]}) + + def is_motion(self, channel=None): + """ Return True if motion is detected """ + return bool(self.getBinaryData("MOTION", channel)) + + def is_motion_detection_active(self, channel=None): + return bool(self.getBinaryData("MOTION_DETECTION_ACTIVE", channel)) + + def get_brightness(self, channel=None): + """ Return brightness from 0 (dark) to 163830 (bright) """ + return float(self.getSensorData("ILLUMINATION", channel)) + + @property + def ELEMENT(self): + return [0, 1, 2, 3] + + class PresenceIP(SensorHmIP, HelperSabotageIP): """Presence detection with HmIP-SPI. This is a binary sensor.""" @@ -529,8 +572,10 @@ def __init__(self, device_description, proxy, resolveparamsets=False): super().__init__(device_description, proxy, resolveparamsets) # init metadata - self.BINARYNODE.update({"PRESENCE_DETECTION_STATE": [1]}) - self.SENSORNODE.update({"ILLUMINATION": [1]}) + self.BINARYNODE.update({"PRESENCE_DETECTION_STATE": self.ELEMENT, + "PRESENCE_DETECTION_ACTIVE": self.ELEMENT}) + self.SENSORNODE.update({"ILLUMINATION": self.ELEMENT, + "CURRENT_ILLUMINATION": self.ELEMENT}) self.ATTRIBUTENODE.update({"ERROR_CODE": [0]}) def is_motion(self, channel=None): @@ -543,7 +588,7 @@ def get_brightness(self, channel=None): @property def ELEMENT(self): - return [0, 1] + return [1] class PresenceIPW(SensorHmIPW): @@ -627,6 +672,16 @@ class IPRemoteMotionV2(Remote, MotionIPV2): def __init__(self, device_description, proxy, resolveparamsets=False): super().__init__(device_description, proxy, resolveparamsets) + +class IPRemoteMotionV2W(Remote, MotionIPV2W): + """Wired motion detection with buttons (hm ip). + This is a binary sensor.""" + + # pylint: disable=useless-super-delegation + def __init__(self, device_description, proxy, resolveparamsets=False): + super().__init__(device_description, proxy, resolveparamsets) + + class LuxSensor(SensorHm): """Sensor for messure LUX.""" @@ -1215,8 +1270,11 @@ def __init__(self, device_description, proxy, resolveparamsets=False): "HM-Sec-MD": MotionV2, "HmIP-SMI": MotionIPContactSabotage, "HmIP-SMI55": IPRemoteMotionV2, + "HmIP-SMI55-2": IPRemoteMotionV2, + "HmIPW-SMI55": IPRemoteMotionV2W, "HmIP-SMO": MotionIP, "HmIP-SMO-A": MotionIP, + "HmIP-SMO-2": MotionIP, "HmIP-SPI": PresenceIP, "HmIPW-SPI": PresenceIPW, "HM-Sen-LI-O": LuxSensor, @@ -1285,4 +1343,5 @@ def __init__(self, device_description, proxy, resolveparamsets=False): "HmIP-STE2-PCB": TempModuleSTE2, "HmIP-SCTH230": CO2SensorIP, "HmIP-DLD": IPLockDLD, + "HmIP-SFD": ParticulateMatterSensorIP, } diff --git a/setup.py b/setup.py index 6f2080bcf..b7d98d19e 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def readme(): PACKAGE_NAME = 'pyhomematic' HERE = os.path.abspath(os.path.dirname(__file__)) -VERSION = '0.1.76' +VERSION = '0.1.77' PACKAGES = find_packages(exclude=['dist', 'build', 'tests'])