Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_rssi_helper(self):
for klass in self.device_classes:
both_rssi_helpers_used = issubclass(HelperRssiDevice, klass) and issubclass(HelperRssiPeer, klass)
self.assertFalse(
both_rssi_helpers_used,
"The class %s inherits from both HelperRssiDevice and HelperRssiPeer, which is not supported." % klass
)
HelperSensorState,
HelperWired, HelperEventRemote, HelperRssiPeer, HelperRssiDevice,
HelperValveState)
LOG = logging.getLogger(__name__)
class HMSensor(HMDevice):
"""This class helps to resolve class inheritance order problems."""
class SensorHmW(HMSensor):
"""Homematic Wired sensors"""
class SensorHmNLB(HMSensor, HelperRssiDevice, HelperRssiPeer):
"""Homematic sensors always have
- strength of the signal received by the device (HelperRssiDevice).
Be aware that standard HM devices have a reversed understanding of PEER
and DEVICE compared to HMIP devices.
- strength of the signal received by the CCU (HelperRssiPeer).
Be aware that standard HM devices have a reversed understanding of PEER
and DEVICE compared to HMIP devices."""
class SensorHm(HMSensor, HelperRssiDevice, HelperRssiPeer, HelperLowBat):
"""Homematic sensors always have
- strength of the signal received by the device (HelperRssiDevice).
Be aware that standard HM devices have a reversed understanding of PEER
and DEVICE compared to HMIP devices.
- strength of the signal received by the CCU (HelperRssiPeer).
Be aware that standard HM devices have a reversed understanding of PEER
"""Stop moving."""
self.actionNodeData("STOP", True, channel)
class Blind(GenericBlind, HelperWorking, 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.ACTIONNODE.update({"STOP": self.ELEMENT})
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):
"""
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.ATTRIBUTENODE.update({"ERROR_SABOTAGE": self.ELEMENT,
"LOWBAT": self.ELEMENT})
self.SENSORNODE.update({"ARMSTATE": [4]})
self.WRITENODE.update({"ARMSTATE": [4]})
@property
def ELEMENT(self):
return [1, 2, 3]
class KeyMatic(HMActor, HelperActorState, HelperRssiPeer):
"""
Lock, Unlock or Open KeyMatic.
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.ACTIONNODE.update({"OPEN": self.ELEMENT})
self.ATTRIBUTENODE.update({"STATE_UNCERTAIN": self.ELEMENT,
"ERROR": self.ELEMENT})
def is_unlocked(self, channel=None):
""" Returns True if KeyMatic is unlocked. """
return self.get_state(channel)
def is_locked(self, channel=None):