How to use the pyhomematic.devicetypes.helper.HelperWired 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 / actors.py View on Github external
class IPBlind(GenericBlind, HelperRssiPeer):
    """
    Blind switch that raises and lowers roller shutters or window blinds.
    """
    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.ATTRIBUTENODE.update({"ACTIVITY_STATE": self.ELEMENT,
                                   "LEVEL_STATUS": self.ELEMENT,
                                   "SECTION": self.ELEMENT})
        self.ACTIONNODE.update({"STOP": self.ELEMENT})
        self.WRITENODE.update({"LEVEL": self.ELEMENT})


class KeyBlind(Blind, HelperActionPress, HelperWired):
    """
    Blind switch that raises and lowers roller shutters or window blinds.
    """
    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)

        # init metadata
        self.WRITENODE.update({"LEVEL": self.ELEMENT})
        self.EVENTNODE.update({"PRESS_SHORT": [1, 2],
                               "PRESS_LONG": [1, 2]})

    @property
    def ELEMENT(self):
        return [3]
github danielperna84 / pyhomematic / pyhomematic / devicetypes / actors.py View on Github external
self._dic.append(chan)
            else:
                # We add the analog channels to self._aic
                self._aic.append(chan)

        # init metadata
        self.BINARYNODE.update({"STATE": self._dic})
        self.SENSORNODE.update({"FREQUENCY": self._fic,  # mHz, from 0.0 to 350000.0
                                "VALUE": self._aic})  # No specific unit, float from 0.0 to 1000.0

    @property
    def ELEMENT(self):
        return self._doc


class IPWSwitch(GenericSwitch, HelperDeviceTemperature, HelperWired):
    """
    HomematicIP-Wired Switch units turning attached device on or off.
    """
    @property
    def ELEMENT(self):
        if "HmIPW-DRS4" in self.TYPE:
            # Address correct switching channels for each relais
            return [2, 6, 10, 14]
        elif "HmIPW-DRS8" in self.TYPE:
            # Address correct switching channels for each relais
            return [2, 6, 10, 14, 18, 22, 26, 30]
        return [1]


class IPWInputDevice(HMEvent, HelperDeviceTemperature, HelperWired):
    """
github danielperna84 / pyhomematic / pyhomematic / devicetypes / actors.py View on Github external
for chan in range(1, 13):
                if self._proxy.getParamset("%s:%i" % (self._ADDRESS, chan), "MASTER").get("BEHAVIOUR", None) == 1:
                    self._doc.append(chan)

    @property
    def ELEMENT(self):
        if "HMW-IO-12-Sw7-DR" in self.TYPE:
            return [13, 14, 15, 16, 17, 18, 19]
        if "HMW-IO-12-FM" in self.TYPE:
            return self._doc
        if "HMW-LC-Sw2-DR" in self.TYPE:
            return [3, 4]
        return [1]


class HMWIOSwitch(GenericSwitch, HelperWired):
    """
    Wired IO module controlling and sensing attached devices.
    """
    def __init__(self, device_description, proxy, resolveparamsets=False):
        # Output channels (digital)
        self._doc = [1, 2, 3, 4, 5, 6]
        # Output channels (digital/analog)
        self._daoc = [7, 8, 9, 10, 11, 12, 13, 14]
        # Output channels (analog), how do we expose these?
        self._aoc = []
        # Input channels (digital/frequency)
        self._dfic = [15, 16, 17, 18, 19, 20]
        # Input channels (digital/analog)
        self._daic = [21, 22, 23, 24, 25, 26]
        # Input channels (digital)
        self._dic = []
github danielperna84 / pyhomematic / pyhomematic / devicetypes / actors.py View on Github external
class IPWSwitch(GenericSwitch, HelperDeviceTemperature, HelperWired):
    """
    HomematicIP-Wired Switch units turning attached device on or off.
    """
    @property
    def ELEMENT(self):
        if "HmIPW-DRS4" in self.TYPE:
            # Address correct switching channels for each relais
            return [2, 6, 10, 14]
        elif "HmIPW-DRS8" in self.TYPE:
            # Address correct switching channels for each relais
            return [2, 6, 10, 14, 18, 22, 26, 30]
        return [1]


class IPWInputDevice(HMEvent, HelperDeviceTemperature, HelperWired):
    """
    IP-Wired component to support long / short press events and state report (e.g. if window contact or on/off switch)
    """
    def __init__(self, device_description, proxy, resolveparamsets=False):
        super().__init__(device_description, proxy, resolveparamsets)
        self._hmipw_keypress_event_channels = []
        self._hmipw_binarysensor_channels = []

        for chan in self.ELEMENT:
            address_channel = "%s:%i" % (self._ADDRESS, chan)
            try:
                channel_paramset = self._proxy.getParamset(address_channel, "MASTER", 0)
                channel_operation_mode = channel_paramset.get("CHANNEL_OPERATION_MODE") if "CHANNEL_OPERATION_MODE" in channel_paramset else 1

                if channel_operation_mode == 1:
                    self._hmipw_keypress_event_channels.append(chan)
github danielperna84 / pyhomematic / pyhomematic / devicetypes / sensors.py View on Github external
    @property
    def ELEMENT(self):
        return [1]


class GongSensor(SensorHm):
    """Wireless Gong Sensor."""

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

        self.EVENTNODE.update({"PRESS_SHORT": self.ELEMENT})


class WiredSensor(SensorHmW, HelperWired):
    """Wired binary Sensor."""

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

        self.BINARYNODE.update({"SENSOR": self.ELEMENT})

    @property
    def ELEMENT(self):
        return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

    def get_state(self, channel=None):
        """ Returns current state of sensor """
        return bool(self.getBinaryData("SENSOR", channel))