How to use the pyhomematic.devicetypes.helper.HelperBinaryState 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
def get_power(self, channel=None):
        """Return power counter."""
        return float(self.getSensorData("POWER", channel))


class Smoke(SensorHm, HelperBinaryState):
    """Smoke alarm.
       This is a binary sensor."""

    def is_smoke(self, channel=None):
        """ Return True if smoke is detected """
        return self.get_state(channel)


class SmokeV2(SensorHm, HelperBinaryState):
    """Smoke alarm with Battery.
       This is a binary sensor."""

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

        self.ATTRIBUTENODE.update({"ERROR_ALARM_TEST": self.ELEMENT,
                                   "ERROR_SMOKE_CHAMBER": self.ELEMENT})

    def is_smoke(self, channel=None):
        """ Return True if smoke is detected """
        return self.get_state(channel)


class IPSmoke(SensorHmIPNoVoltage):
    """HomeMatic IP Smoke sensor."""
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
return float(self.getSensorData("GAS_ENERGY_COUNTER", channel))

    def get_gas_power(self, channel=None):
        """Return gas power."""
        return float(self.getSensorData("GAS_POWER", channel))

    def get_energy(self, channel=None):
        """Return energy counter."""
        return float(self.getSensorData("ENERGY_COUNTER", channel))

    def get_power(self, channel=None):
        """Return power counter."""
        return float(self.getSensorData("POWER", channel))


class Smoke(SensorHm, HelperBinaryState):
    """Smoke alarm.
       This is a binary sensor."""

    def is_smoke(self, channel=None):
        """ Return True if smoke is detected """
        return self.get_state(channel)


class SmokeV2(SensorHm, HelperBinaryState):
    """Smoke alarm with Battery.
       This is a binary sensor."""

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

        self.ATTRIBUTENODE.update({"ERROR_ALARM_TEST": self.ELEMENT,
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
def is_open(self, channel=None):
        """ Returns True if the contact is open. """
        return self.get_state(channel)

    def is_closed(self, channel=None):
        """ Returns True if the contact is closed. """
        return not self.get_state(channel)

    @property
    def ELEMENT(self):
        if "HM-SCI-3-FM" in self._TYPE:
            return [1, 2, 3]
        return [1]


class IPShutterContact(SensorHmIP, HelperBinaryState):
    """Door / Window contact that emits its open/closed state.
       This is a binary sensor."""

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

    def is_closed(self, channel=None):
        """ Returns True if the contact is closed. """
        return not self.get_state(channel)


class IPShutterContactSabotage(IPShutterContact, HelperSabotageIP):
    """Same as IPShutterContact, but with sabotage detection."""
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
This is a binary sensor."""

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

    def is_closed(self, channel=None):
        """ Returns True if the contact is closed. """
        return not self.get_state(channel)


class IPShutterContactSabotage(IPShutterContact, HelperSabotageIP):
    """Same as IPShutterContact, but with sabotage detection."""


class MaxShutterContact(HelperBinaryState, HelperLowBat):
    """Door / Window contact that emits its open/closed state.
       This is a binary sensor."""


class TiltSensor(SensorHm, HelperBinaryState):
    """Sensor that emits its tilted state.
       This is a binary sensor."""

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

    def is_not_tilted(self, channel=None):
        """ Returns True if the contact is not tilted. """
        return not self.get_state(channel)
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
def is_closed(self, channel=None):
        """ Returns True if the contact is closed. """
        return not self.get_state(channel)


class IPShutterContactSabotage(IPShutterContact, HelperSabotageIP):
    """Same as IPShutterContact, but with sabotage detection."""


class MaxShutterContact(HelperBinaryState, HelperLowBat):
    """Door / Window contact that emits its open/closed state.
       This is a binary sensor."""


class TiltSensor(SensorHm, HelperBinaryState):
    """Sensor that emits its tilted state.
       This is a binary sensor."""

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

    def is_not_tilted(self, channel=None):
        """ Returns True if the contact is not tilted. """
        return not self.get_state(channel)


class RotaryHandleSensor(SensorHm, HelperSensorState, HelperSabotage):
    """Window handle contact."""

    def is_open(self, channel=None):
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
- but no voltage of batteries"""


class SensorHmIPNoBattery(HMSensor, HelperRssiDevice):
    """Some Homematic IP sensors have
         - strength of the signal received by the CCU (HelperRssiDevice).
           Be aware that HMIP devices have a reversed understanding of PEER
           and DEVICE compared to standard HM devices.
         - strength of the signal received by the device (HelperRssiPeer).
           Be aware that standard HMIP devices have a reversed understanding of PEER
           and DEVICE compared to standard HM devices.
         - low battery status (HelperLowBatIP)
         - but no voltage of batteries"""


class ShutterContact(SensorHm, HelperBinaryState, HelperSabotage):
    """Door / Window contact that emits its open/closed state.
       This is a binary sensor."""

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

    def is_closed(self, channel=None):
        """ Returns True if the contact is closed. """
        return not self.get_state(channel)

    @property
    def ELEMENT(self):
        if "HM-SCI-3-FM" in self._TYPE:
            return [1, 2, 3]
        return [1]