Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Battery operated HomeMaticIP remote device."""
class RemoteBattery(Remote, HelperLowBat):
"""Battery operated HomeMatic remote device."""
class RemotePress(HMEvent, HelperEventPress, HelperActionPress):
"""Remote handle buttons."""
@property
def ELEMENT(self):
return [1, 2, 3]
class RemotePressBattery(HMEvent, HelperEventPress, HelperActionPress, HelperLowBat):
"""Remote handle buttons."""
@property
def ELEMENT(self):
return [1, 2, 3]
DEVICETYPES = {
"HM-RCV-50": RemoteVirtual,
"HM-RC-2-PBU-FM": Remote,
"HM-RC-Dis-H-x-EU": Remote,
"HM-RC-4": RemoteBattery,
"HM-RC-4-B": RemoteBattery,
"HM-RC-4-2": RemoteBattery,
"HM-RC-4-3": RemoteBattery,
"HM-RC-4-3-D": RemoteBattery,
@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]
class IPKeySwitch(IPSwitch, 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]})
@property
def ELEMENT(self):
return [4]
class IPKeySwitchLevel(GenericDimmer, GenericSwitch, HMEvent, HelperActionPress, HelperActorLevel):
"""
if "HmIP-RC8" in self.TYPE:
return [1, 2, 3, 4, 5, 6, 7, 8]
if "HmIP-WRCD" in self.TYPE:
return [1, 2, 3]
return [1]
class RemoteBatteryIP(Remote, HelperLowBatIP):
"""Battery operated HomeMaticIP remote device."""
class RemoteBattery(Remote, HelperLowBat):
"""Battery operated HomeMatic remote device."""
class RemotePress(HMEvent, HelperEventPress, HelperActionPress):
"""Remote handle buttons."""
@property
def ELEMENT(self):
return [1, 2, 3]
class RemotePressBattery(HMEvent, HelperEventPress, HelperActionPress, HelperLowBat):
"""Remote handle buttons."""
@property
def ELEMENT(self):
return [1, 2, 3]
DEVICETYPES = {
class LuxSensor(SensorHm):
"""Sensor for messure LUX."""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"LUX": [1]})
def get_lux(self, channel=None):
"""Return messure lux."""
return float(self.getSensorData("LUX", channel))
class ImpulseSensor(HMEvent):
"""Inpulse sensor."""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.EVENTNODE.update({"SEQUENCE_OK": self.ELEMENT})
class AreaThermostat(SensorHmNLB):
"""Wall mount thermostat."""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
if "HmIP-FSM" in self.TYPE or "HmIP-FSM16" in self.TYPE:
sensorIndex = 5
elif "HMIP-PSM" in self.TYPE or "HmIP-PSM" in self.TYPE or "HmIP-PSM-CH" in self.TYPE:
sensorIndex = 6
elif "HmIP-BSM" in self.TYPE:
sensorIndex = 7
if sensorIndex is not None:
self.SENSORNODE.update({"POWER": [sensorIndex],
"CURRENT": [sensorIndex],
"VOLTAGE": [sensorIndex],
"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)