Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #145 from maxm87/devel
Browse files Browse the repository at this point in the history
Update sensors.py - added SmartwareMotion Detector
  • Loading branch information
danielperna84 authored Jul 14, 2018
2 parents 8644f1f + f56614e commit 9df98fb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pyhomematic/devicetypes/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,24 @@ def get_brightness(self, channel=None):
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})

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):
"""Motion detection version 2."""
pass
Expand Down Expand Up @@ -684,4 +702,5 @@ def get_air_pressure(self, channel=None):
"HmIP-STHO": IPAreaThermostat,
"HmIP-STHO-A": IPAreaThermostat,
"HmIP-SPDR": IPPassageSensor,
"IT-Old-Remote-1-Channel": SmartwareMotion,
}

0 comments on commit 9df98fb

Please sign in to comment.