How to use the pyhomematic.devicetypes.sensors.SensorHmIP function in pyhomematic

To help you get started, we’ve selected a few pyhomematic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
""" 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."""

    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.ATTRIBUTENODE.update({"ERROR_CODE": [0]})

    def is_motion(self, channel=None):
        """ Return True if motion is detected """
        return bool(self.getBinaryData("PRESENCE_DETECTION_STATE", channel))

    def get_brightness(self, channel=None):
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.SENSORNODE.update({"PASSAGE_COUNTER_VALUE": self.ELEMENT})
        self.BINARYNODE.update({"PASSAGE_COUNTER_OVERFLOW": self.ELEMENT,
                                "LAST_PASSAGE_DIRECTION": [2],
                                "CURRENT_PASSAGE_DIRECTION": [2]})

    @property
    def ELEMENT(self):
        return [2, 3]


class IPWeatherSensor(SensorHmIP):
    """HomeMatic IP Weather sensor.
       This is a binary sensor."""

    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [1],
                                "HUMIDITY": [1],
                                "RAIN_COUNTER": [1],
                                "WIND_SPEED": [1],
                                "WIND_DIR": [1],
                                "WIND_DIR_RANGE": [1],
                                "SUNSHINEDURATION": [1],
                                "ILLUMINATION": [1]})
        self.BINARYNODE.update({"RAINING": [1]})
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
return int(self.getSensorData("AIR_PRESSURE", channel))

    def get_luminosity(self, channel=None):
        if "HB-UNI-Sensor1" in self._TYPE:
            return float(self.getSensorData("LUX", channel))
        else:
            return float(self.getSensorData("LUMINOSITY", channel))

    def get_battery_voltage(self, channel=None):
        if "HB-UNI-Sensor1" in self._TYPE:
            return float(self.getSensorData("OPERATING_VOLTAGE", channel))
        else:
            return float(self.getSensorData("BatteryVoltage", channel))


class WaterIP(SensorHmIP):
    """Water sensor HmIP-SWD
       This is a binary sensor."""

    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.BINARYNODE.update({"ALARMSTATE": self.ELEMENT,
                                "MOISTURE_DETECTED": self.ELEMENT,
                                "WATERLEVEL_DETECTED": self.ELEMENT})

    @property
    def ELEMENT(self):
        return [1]
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
"""Window handle contact."""

    def is_open(self, channel=None):
        """ Returns True if the handle is set to open. """
        return self.get_state(channel) == 2

    def is_closed(self, channel=None):
        """ Returns True if the handle is set to closed. """
        return self.get_state(channel) == 0

    def is_tilted(self, channel=None):
        """ Returns True if the handle is set to tilted. """
        return self.get_state(channel) == 1


class RotaryHandleSensorIP(SensorHmIP, HelperSensorState, HelperSabotageIP):
    """Window handle contact."""

    def is_open(self, channel=None):
        """ Returns True if the handle is set to open. """
        return self.get_state(channel) == 2

    def is_closed(self, channel=None):
        """ Returns True if the handle is set to closed. """
        return self.get_state(channel) == 0

    def is_tilted(self, channel=None):
        """ Returns True if the handle is set to tilted. """
        return self.get_state(channel) == 1


class CO2Sensor(SensorHm, HelperSensorState):
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
# init metadata
        self.SENSORNODE.update({"TEMPERATURE": self.ELEMENT,
                                "HUMIDITY": self.ELEMENT,
                                "AIR_PRESSURE": self.ELEMENT})

    def get_temperature(self, channel=None):
        return float(self.getSensorData("TEMPERATURE", channel))

    def get_humidity(self, channel=None):
        return int(self.getSensorData("HUMIDITY", channel))

    def get_air_pressure(self, channel=None):
        return int(self.getSensorData("AIR_PRESSURE", channel))


class IPBrightnessSensor(SensorHmIP):
    """IP Sensor for outdoor brightness measure"""

    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.SENSORNODE.update({"CURRENT_ILLUMINATION": [1],
                                "AVERAGE_ILLUMINATION": [1],
                                "LOWEST_ILLUMINATION": [1],
                                "HIGHEST_ILLUMINATION": [1]})


class UniversalSensor(HMSensor, HelperLowBat, HelperRssiPeer, HelperValveState):
    """Universal sensor. (https://wiki.fhem.de/wiki/Universalsensor)"""

    def __init__(self, device_description, proxy, resolveparamsets=False):
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.BINARYNODE.update({"MOTION": self.ELEMENT})
        self.SENSORNODE.update({"BRIGHTNESS": self.ELEMENT})

    def is_motion(self, channel=None):
        """ Return True if motion is detected """
        return bool(self.getBinaryData("MOTION", channel))

    def get_brightness(self, channel=None):
        """ Return brightness from 0 (dark ) to 255 (bright) """
        return int(self.getSensorData("BRIGHTNESS", channel))


class MotionIP(SensorHmIP):
    """Motion detection indoor (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": [1], "MOTION": [1]})
        self.SENSORNODE.update({"ILLUMINATION": [1]})
        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):
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
self.ATTRIBUTENODE.update({"ERROR_CODE": [0]})

    def is_motion(self, channel=None):
        """ Return True if motion is detected """
        return bool(self.getBinaryData("PRESENCE_DETECTION_STATE", 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]


class TiltIP(SensorHmIP):
    """Tilt detection with HmIP-SAM.
       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": [1]})
        self.ATTRIBUTENODE.update({"ERROR_CODE": [0]})

    def is_motion(self, channel=None):
        """ Return True if motion is detected """
        return bool(self.getBinaryData("MOTION", channel))

    @property
    def ELEMENT(self):