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

adding PRESS events support for HmIP-BSM #146

Merged
merged 4 commits into from
Jul 14, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pyhomematic/devicetypes/actors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from pyhomematic.devicetypes.generic import HMDevice
from pyhomematic.devicetypes.sensors import HMSensor
from pyhomematic.devicetypes.misc import HMEvent
from pyhomematic.devicetypes.helper import (
HelperWorking, HelperActorState, HelperActorLevel, HelperActorBlindTilt, HelperActionOnTime,
HelperActionPress, HelperEventRemote, HelperWired)
Expand Down Expand Up @@ -400,6 +401,18 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
"ENERGY_COUNTER": [sensorIndex]})


class IPKeySwitchPowermeter(IPSwitchPowermeter, HMEvent, HelperActionPress):
"""
Switch turning plugged in device on or off and measuring energy consumption.
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)

self.ELEMENT.extend([1, 2])
Copy link
Owner

@danielperna84 danielperna84 Jul 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can leave away the ELEMENT since you are setting channels 1 and 2 explicitly in the EVENTNODE. Could you please try if it works without this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appears to work without explicitly extending ELEMENT. Pull request updated accordingly!

self.EVENTNODE.update({"PRESS_SHORT": [1, 2],
"PRESS_LONG": [1, 2]})


DEVICETYPES = {
"HM-LC-Bl1-SM": Blind,
"HM-LC-Bl1-SM-2": Blind,
Expand Down Expand Up @@ -518,7 +531,7 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
"HmIP-PSM-CH": IPSwitchPowermeter,
"HmIP-FSM": IPSwitchPowermeter,
"HmIP-FSM16": IPSwitchPowermeter,
"HmIP-BSM": IPSwitchPowermeter,
"HmIP-BSM": IPKeySwitchPowermeter,
"HMIP-BDT": IPKeyDimmer,
"HmIP-BDT": IPKeyDimmer,
"HM-Sec-Key": KeyMatic,
Expand Down