Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"FREQUENCY": [sensorIndex],
"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.EVENTNODE.update({"PRESS_SHORT": [1, 2],
"PRESS_LONG": [1, 2]})
class IPGarage(GenericSwitch, GenericBlind, HMSensor):
"""
HmIP-MOD-HO and HmIP-MOD-TM Garage actor
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"DOOR_STATE": [1]})
def is_closed(self, state):
"""Returns whether the door is closed"""
# States:
# 0: closed
# 1: open
# 2: ventilation
# 3: unknown
return self.set_state(False, channel)
def open(self):
"""Opens the door.
Keep in mind that in most cases the door can only be closed physically.
If the KeyMatic is in locked state it will unlock first.
After opening the door the state of KeyMatic is unlocked.
"""
return self.setValue("OPEN", True)
@property
def ELEMENT(self):
return [1]
class IPSwitch(GenericSwitch, HelperActionOnTime):
"""
Switch turning attached device on or off.
"""
@property
def ELEMENT(self):
if "HmIP-BSM" in self.TYPE:
return [4]
elif "HmIP-FSM" in self.TYPE or "HmIP-FSM16" in self.TYPE:
return [2]
elif "HmIP-MOD-OC8" in self.TYPE:
return [10, 14, 18, 22, 26, 30, 34, 38]
elif "HmIP-DRSI4" in self.TYPE:
return [6, 10, 14, 18]
else:
return [3]