diff --git a/custom_components/nhc2/entities/alloff_action_active.py b/custom_components/nhc2/entities/alloff_action_active.py index 5950fe9a..05b19aae 100644 --- a/custom_components/nhc2/entities/alloff_action_active.py +++ b/custom_components/nhc2/entities/alloff_action_active.py @@ -19,7 +19,7 @@ def __init__(self, device_instance: CocoAlloffAction, hub, gateway): self._attr_unique_id = device_instance.uuid + '_alloff_active' self._attr_should_poll = False - self._attr_state = self._device.status_all_off_active + self._attr_state = self._device.is_all_off_active self._attr_state_class = None @property @@ -41,7 +41,7 @@ def device_info(self): @property def is_on(self) -> bool: - return self._device.status_all_off_active == 'True' + return self._device.is_all_off_active def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/alloff_action_basicstate.py b/custom_components/nhc2/entities/alloff_action_basicstate.py index 519b7737..2ce88980 100644 --- a/custom_components/nhc2/entities/alloff_action_basicstate.py +++ b/custom_components/nhc2/entities/alloff_action_basicstate.py @@ -19,7 +19,7 @@ def __init__(self, device_instance: CocoAlloffAction, hub, gateway): self._attr_unique_id = device_instance.uuid + '_alloff_basic_state' self._attr_should_poll = False - self._attr_state = self._device.status_basic_state + self._attr_state = self._device.is_basic_state_on self._attr_state_class = None @property @@ -41,7 +41,7 @@ def device_info(self): @property def is_on(self) -> bool: - return self._device.status_basic_state == 'On' + return self._device.is_basic_state_on def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/dimmer_action_alligned.py b/custom_components/nhc2/entities/dimmer_action_alligned.py index da222f06..93c2b415 100644 --- a/custom_components/nhc2/entities/dimmer_action_alligned.py +++ b/custom_components/nhc2/entities/dimmer_action_alligned.py @@ -20,7 +20,7 @@ def __init__(self, device_instance: CocoDimmerAction, hub, gateway): self._attr_unique_id = device_instance.uuid + '_aligned' self._attr_should_poll = False - self._attr_state = self._device.status_aligned + self._attr_state = self._device.is_aligned self._attr_state_class = None self._attr_entity_category = EntityCategory.DIAGNOSTIC @@ -43,7 +43,7 @@ def device_info(self): @property def is_on(self) -> bool: - return self._device.status_aligned + return self._device.is_aligned def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/naso_smartplug_electrical_power.py b/custom_components/nhc2/entities/naso_smartplug_electrical_power.py index ac7af595..67e45dd9 100644 --- a/custom_components/nhc2/entities/naso_smartplug_electrical_power.py +++ b/custom_components/nhc2/entities/naso_smartplug_electrical_power.py @@ -52,7 +52,7 @@ def state(self) -> float: def on_change(self): # Re-enable reporting when it is turned off - if self._device.report_instant_usage is False: + if self._device.is_report_instant_usage is False: _LOGGER.debug(f'{self.name} re-enabled') self._device.enable_report_instant_usage(self._gateway) diff --git a/custom_components/nhc2/entities/naso_smartplug_feedback_enabled.py b/custom_components/nhc2/entities/naso_smartplug_feedback_enabled.py index 68b049d7..9de71c56 100644 --- a/custom_components/nhc2/entities/naso_smartplug_feedback_enabled.py +++ b/custom_components/nhc2/entities/naso_smartplug_feedback_enabled.py @@ -20,7 +20,7 @@ def __init__(self, device_instance: CocoNasoSmartplug, hub, gateway): self._attr_unique_id = device_instance.uuid + '_feedback_enabled' self._attr_should_poll = False - self._attr_state = self._device.feedback_enabled + self._attr_state = self._device.is_feedback_enabled self._attr_state_class = None self._attr_entity_category = EntityCategory.DIAGNOSTIC @@ -42,8 +42,8 @@ def device_info(self): } @property - def is_on(self) -> bool: - return self._device.feedback_enabled + def is_on(self) -> bool | None: + return self._device.is_feedback_enabled def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/naso_smartplug_measuring_only.py b/custom_components/nhc2/entities/naso_smartplug_measuring_only.py index 440f511f..b5dcf35c 100644 --- a/custom_components/nhc2/entities/naso_smartplug_measuring_only.py +++ b/custom_components/nhc2/entities/naso_smartplug_measuring_only.py @@ -20,7 +20,7 @@ def __init__(self, device_instance: CocoNasoSmartplug, hub, gateway): self._attr_unique_id = device_instance.uuid + '_measuring_only' self._attr_should_poll = False - self._attr_state = self._device.measuring_only + self._attr_state = self._device.is_measuring_only self._attr_state_class = None self._attr_entity_category = EntityCategory.DIAGNOSTIC @@ -43,7 +43,7 @@ def device_info(self): @property def is_on(self) -> bool: - return self._device.measuring_only + return self._device.is_measuring_only def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/naso_smartplug_report_instant_usage.py b/custom_components/nhc2/entities/naso_smartplug_report_instant_usage.py index 3c11d0e0..4fcebebb 100644 --- a/custom_components/nhc2/entities/naso_smartplug_report_instant_usage.py +++ b/custom_components/nhc2/entities/naso_smartplug_report_instant_usage.py @@ -20,7 +20,7 @@ def __init__(self, device_instance: CocoNasoSmartplug, hub, gateway): self._attr_unique_id = device_instance.uuid + '_report_instant_usage' self._attr_should_poll = False - self._attr_state = self._device.report_instant_usage + self._attr_state = self._device.is_report_instant_usage self._attr_state_class = None self._attr_entity_category = EntityCategory.DIAGNOSTIC @@ -43,7 +43,7 @@ def device_info(self): @property def is_on(self) -> bool: - return self._device.report_instant_usage + return self._device.is_report_instant_usage def on_change(self): self.schedule_update_ha_state() diff --git a/custom_components/nhc2/entities/relay_action_switch.py b/custom_components/nhc2/entities/relay_action_switch.py index 2a3e3491..03c95e9c 100644 --- a/custom_components/nhc2/entities/relay_action_switch.py +++ b/custom_components/nhc2/entities/relay_action_switch.py @@ -34,10 +34,6 @@ def device_info(self): 'via_device': self._hub } - @property - def is_on(self) -> bool: - return self._device.is_on - @property def device_class(self) -> str: if self._device.model == 'socket': @@ -45,6 +41,10 @@ def device_class(self) -> str: return SwitchDeviceClass.SWITCH + @property + def is_on(self) -> bool: + return self._device.is_on + def turn_off(self, **kwargs) -> None: """Pass - not in use.""" pass diff --git a/custom_components/nhc2/nhccoco/const.py b/custom_components/nhc2/nhccoco/const.py index 36bbef2e..094f97be 100755 --- a/custom_components/nhc2/nhccoco/const.py +++ b/custom_components/nhc2/nhccoco/const.py @@ -91,4 +91,37 @@ MQTT_TOPIC_PUBLIC_RSP = '/system/rsp' MQTT_TOPIC_SUFFIX_CMD = '/control/devices/cmd' MQTT_TOPIC_SUFFIX_RSP = '/control/devices/rsp' -MQTT_TOPIC_SUFFIX_EVT = '/control/devices/evt' \ No newline at end of file +MQTT_TOPIC_SUFFIX_EVT = '/control/devices/evt' + +DEVICE_DESCRIPTOR_UUID = 'Uuid' +DEVICE_DESCRIPTOR_TYPE = 'Type' +DEVICE_DESCRIPTOR_TECHNOLOGY = 'Technology' +DEVICE_DESCRIPTOR_MODEL = 'Model' +DEVICE_DESCRIPTOR_IDENTIFIER = 'Identifier' +DEVICE_DESCRIPTOR_NAME = 'Name' +DEVICE_DESCRIPTOR_TRAITS = 'Traits' +DEVICE_DESCRIPTOR_PARAMETERS = 'Parameters' +DEVICE_DESCRIPTOR_PROPERTIES = 'Properties' +DEVICE_DESCRIPTOR_ONLINE = 'Online' +DEVICE_DESCRIPTOR_ONLINE_VALUE_TRUE = 'True' + +PARAMETER_FEEDBACK_ENABLED = 'FeedbackEnabled' +PARAMETER_FEEDBACK_ENABLED_VALUE_TRUE = 'True' +PARAMETER_MEASURING_ONLY = 'MeasuringOnly' +PARAMETER_MEASURING_ONLY_VALUE_TRUE = 'True' + +PROPERTY_ALIGNED = 'Aligned' +PROPERTY_ALIGNED_VALUE_TRUE = 'True' +PROPERTY_ALL_OFF_ACTIVE = 'AllOffActive' +PROPERTY_ALL_OFF_ACTIVE_VALUE_TRUE = 'True' +PROPERTY_BASIC_STATE = 'BasicState' +PROPERTY_BASIC_STATE_VALUE_ON = 'On' +PROPERTY_BASIC_STATE_VALUE_TRIGGERED = 'Triggered' +PROPERTY_BRIGHTNESS = 'Brightness' +PROPERTY_ELECTRICAL_POWER = 'ElectricalPower' +PROPERTY_REPORT_INSTANT_USAGE = 'ReportInstantUsage' +PROPERTY_REPORT_INSTANT_USAGE_VALUE_TRUE = 'True' +PROPERTY_REPORT_INSTANT_USAGE_VALUE_FALSE = 'False' +PROPERTY_STATUS = 'Status' +PROPERTY_STATUS_VALUE_ON = 'On' +PROPERTY_STATUS_VALUE_OFF = 'Off' diff --git a/custom_components/nhc2/nhccoco/devices/alloff_action.py b/custom_components/nhc2/nhccoco/devices/alloff_action.py index 547857f5..662a2ca7 100644 --- a/custom_components/nhc2/nhccoco/devices/alloff_action.py +++ b/custom_components/nhc2/nhccoco/devices/alloff_action.py @@ -1,3 +1,5 @@ +from ..const import DEVICE_DESCRIPTOR_PROPERTIES, PROPERTY_BASIC_STATE, PROPERTY_ALL_OFF_ACTIVE, \ + PROPERTY_ALL_OFF_ACTIVE_VALUE_TRUE, PROPERTY_BASIC_STATE_VALUE_ON, PROPERTY_BASIC_STATE_VALUE_TRIGGERED from .device import CoCoDevice import logging @@ -8,24 +10,36 @@ class CocoAlloffAction(CoCoDevice): @property def status_basic_state(self) -> str: - return self.extract_property_value('BasicState') + return self.extract_property_value(PROPERTY_BASIC_STATE) @property def status_all_off_active(self) -> str: - return self.extract_property_value('AllOffActive') + return self.extract_property_value(PROPERTY_ALL_OFF_ACTIVE) @property def is_on(self) -> bool: - return self.status_basic_state == 'On' + return self.status_basic_state == PROPERTY_BASIC_STATE_VALUE_ON + + @property + def is_all_off_active(self) -> bool: + return self.status_all_off_active == PROPERTY_ALL_OFF_ACTIVE_VALUE_TRUE + + @property + def is_basic_state_on(self) -> bool: + return self.status_basic_state == PROPERTY_BASIC_STATE_VALUE_ON def on_change(self, topic: str, payload: dict): _LOGGER.debug(f'{self.name} changed. Topic: {topic} | Data: {payload}') - if 'Properties' in payload: - self.merge_properties(payload['Properties']) + if DEVICE_DESCRIPTOR_PROPERTIES in payload: + self.merge_properties(payload[DEVICE_DESCRIPTOR_PROPERTIES]) if self._after_change_callbacks: for callback in self._after_change_callbacks: callback() def press(self, gateway): - gateway._add_device_control(self._device.uuid, "BasicState", "Triggered") + gateway._add_device_control( + self._device.uuid, + PROPERTY_BASIC_STATE, + PROPERTY_BASIC_STATE_VALUE_TRIGGERED + ) diff --git a/custom_components/nhc2/nhccoco/devices/device.py b/custom_components/nhc2/nhccoco/devices/device.py index 7867145f..a1d7c008 100644 --- a/custom_components/nhc2/nhccoco/devices/device.py +++ b/custom_components/nhc2/nhccoco/devices/device.py @@ -1,3 +1,8 @@ +from ..const import DEVICE_DESCRIPTOR_UUID, DEVICE_DESCRIPTOR_TYPE, DEVICE_DESCRIPTOR_TECHNOLOGY, \ + DEVICE_DESCRIPTOR_MODEL, DEVICE_DESCRIPTOR_IDENTIFIER, DEVICE_DESCRIPTOR_NAME, DEVICE_DESCRIPTOR_TRAITS, \ + DEVICE_DESCRIPTOR_PARAMETERS, DEVICE_DESCRIPTOR_PROPERTIES, DEVICE_DESCRIPTOR_ONLINE, \ + DEVICE_DESCRIPTOR_ONLINE_VALUE_TRUE + import logging _LOGGER = logging.getLogger(__name__) @@ -5,18 +10,18 @@ class CoCoDevice(): def __init__(self, json: dict): - self._uuid = json['Uuid'] - self._type = json['Type'] - self._technology = json['Technology'] - self._model = json['Model'] - self._identifier = json['Identifier'] - self._name = json['Name'] - self._traits = json['Traits'] if 'Traits' in json else None - self._parameters = json['Parameters'] if 'Parameters' in json else None - self._properties = json['Properties'] if 'Properties' in json else None + self._uuid = json[DEVICE_DESCRIPTOR_UUID] + self._type = json[DEVICE_DESCRIPTOR_TYPE] + self._technology = json[DEVICE_DESCRIPTOR_TECHNOLOGY] + self._model = json[DEVICE_DESCRIPTOR_MODEL] + self._identifier = json[DEVICE_DESCRIPTOR_IDENTIFIER] + self._name = json[DEVICE_DESCRIPTOR_NAME] + self._traits = json[DEVICE_DESCRIPTOR_TRAITS] if DEVICE_DESCRIPTOR_TRAITS in json else None + self._parameters = json[DEVICE_DESCRIPTOR_PARAMETERS] if DEVICE_DESCRIPTOR_PARAMETERS in json else None + self._properties = json[DEVICE_DESCRIPTOR_PROPERTIES] if DEVICE_DESCRIPTOR_PROPERTIES in json else None self._after_change_callbacks = [] - self._online = json['Online'] if 'Online' in json else None + self._online = json[DEVICE_DESCRIPTOR_ONLINE] if DEVICE_DESCRIPTOR_ONLINE in json else None @property def uuid(self) -> str: @@ -63,7 +68,7 @@ def is_online(self) -> bool: """Device is online""" if self._online is None: return None - return self._online == 'True' + return self._online == DEVICE_DESCRIPTOR_ONLINE_VALUE_TRUE @property def after_change_callbacks(self): diff --git a/custom_components/nhc2/nhccoco/devices/dimmer_action.py b/custom_components/nhc2/nhccoco/devices/dimmer_action.py index 518a2049..0a3debf8 100644 --- a/custom_components/nhc2/nhccoco/devices/dimmer_action.py +++ b/custom_components/nhc2/nhccoco/devices/dimmer_action.py @@ -1,3 +1,5 @@ +from ..const import DEVICE_DESCRIPTOR_PROPERTIES, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_ON, PROPERTY_STATUS_VALUE_OFF, \ + PROPERTY_BRIGHTNESS, PROPERTY_ALIGNED, PROPERTY_ALIGNED_VALUE_TRUE from .device import CoCoDevice import logging @@ -7,20 +9,24 @@ class CocoDimmerAction(CoCoDevice): @property - def status_status(self) -> str: - return self.extract_property_value('Status') + def status(self) -> str: + return self.extract_property_value(PROPERTY_STATUS) @property def status_brightness(self) -> int: - return int(self.extract_property_value('Brightness')) + return int(self.extract_property_value(PROPERTY_BRIGHTNESS)) @property - def status_aligned(self) -> bool: - return self.extract_property_value('Aligned') == 'True' + def status_aligned(self) -> str: + return self.extract_property_value(PROPERTY_ALIGNED) @property def is_on(self) -> bool: - return self.status_status == 'On' + return self.status == PROPERTY_STATUS_VALUE_ON + + @property + def is_aligned(self) -> bool: + return self.status_aligned == PROPERTY_ALIGNED_VALUE_TRUE @property def support_brightness(self) -> bool: @@ -28,18 +34,18 @@ def support_brightness(self) -> bool: def on_change(self, topic: str, payload: dict): _LOGGER.debug(f'{self.name} changed. Topic: {topic} | Data: {payload}') - if 'Properties' in payload: - self.merge_properties(payload['Properties']) + if DEVICE_DESCRIPTOR_PROPERTIES in payload: + self.merge_properties(payload[DEVICE_DESCRIPTOR_PROPERTIES]) if self._after_change_callbacks: for callback in self._after_change_callbacks: callback() def turn_on(self, gateway): - gateway._add_device_control(self.uuid, "Status", "On") + gateway._add_device_control(self.uuid, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_ON) def turn_off(self, gateway): - gateway._add_device_control(self.uuid, "Status", "Off") + gateway._add_device_control(self.uuid, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_OFF) def set_brightness(self, gateway, brightness: int): - gateway._add_device_control(self.uuid, "Brightness", str(brightness)) + gateway._add_device_control(self.uuid, PROPERTY_BRIGHTNESS, str(brightness)) diff --git a/custom_components/nhc2/nhccoco/devices/light_action.py b/custom_components/nhc2/nhccoco/devices/light_action.py index 33dce6aa..d22b5356 100644 --- a/custom_components/nhc2/nhccoco/devices/light_action.py +++ b/custom_components/nhc2/nhccoco/devices/light_action.py @@ -1,10 +1,11 @@ +from ..const import PROPERTY_STATUS_VALUE_ON from .relay_action import CocoRelayAction class CocoLightAction(CocoRelayAction): @property def is_on(self) -> bool: - return self.status_status == 'On' + return self.status == PROPERTY_STATUS_VALUE_ON @property def support_brightness(self) -> bool: diff --git a/custom_components/nhc2/nhccoco/devices/naso_smartplug.py b/custom_components/nhc2/nhccoco/devices/naso_smartplug.py index e66e2218..10db7c21 100644 --- a/custom_components/nhc2/nhccoco/devices/naso_smartplug.py +++ b/custom_components/nhc2/nhccoco/devices/naso_smartplug.py @@ -1,3 +1,6 @@ +from ..const import DEVICE_DESCRIPTOR_PROPERTIES, PROPERTY_ELECTRICAL_POWER, PROPERTY_REPORT_INSTANT_USAGE, \ + PROPERTY_REPORT_INSTANT_USAGE_VALUE_TRUE, PARAMETER_FEEDBACK_ENABLED, PARAMETER_FEEDBACK_ENABLED_VALUE_TRUE, \ + PARAMETER_MEASURING_ONLY, PARAMETER_MEASURING_ONLY_VALUE_TRUE from .device import CoCoDevice import logging @@ -8,28 +11,32 @@ class CocoNasoSmartplug(CoCoDevice): @property def electrical_power(self) -> float: - return float(self.extract_property_value('ElectricalPower')) + return float(self.extract_property_value(PROPERTY_ELECTRICAL_POWER)) @property - def report_instant_usage(self) -> bool: - return self.extract_property_value('ReportInstantUsage') == 'True' + def is_report_instant_usage(self) -> bool: + return self.extract_property_value(PROPERTY_REPORT_INSTANT_USAGE) == PROPERTY_REPORT_INSTANT_USAGE_VALUE_TRUE @property - def feedback_enabled(self) -> bool: - return self.extract_parameter_value('FeedbackEnabled') == 'True' + def is_feedback_enabled(self) -> bool: + return self.extract_parameter_value(PARAMETER_FEEDBACK_ENABLED) == PARAMETER_FEEDBACK_ENABLED_VALUE_TRUE @property - def measuring_only(self) -> bool: - return self.extract_parameter_value('MeasuringOnly') == 'True' + def is_measuring_only(self) -> bool: + return self.extract_parameter_value(PARAMETER_MEASURING_ONLY) == PARAMETER_MEASURING_ONLY_VALUE_TRUE def on_change(self, topic: str, payload: dict): _LOGGER.debug(f'{self.name} changed. Topic: {topic} | Data: {payload}') - if 'Properties' in payload: - self.merge_properties(payload['Properties']) + if DEVICE_DESCRIPTOR_PROPERTIES in payload: + self.merge_properties(payload[DEVICE_DESCRIPTOR_PROPERTIES]) if self._after_change_callbacks: for callback in self._after_change_callbacks: callback() def enable_report_instant_usage(self, gateway): - gateway._add_device_control(self._device.uuid, "ReportInstantUsage", "True") + gateway._add_device_control( + self._device.uuid, + PROPERTY_REPORT_INSTANT_USAGE, + PROPERTY_REPORT_INSTANT_USAGE_VALUE_TRUE + ) diff --git a/custom_components/nhc2/nhccoco/devices/relay_action.py b/custom_components/nhc2/nhccoco/devices/relay_action.py index 05d2261a..32e5a483 100644 --- a/custom_components/nhc2/nhccoco/devices/relay_action.py +++ b/custom_components/nhc2/nhccoco/devices/relay_action.py @@ -1,3 +1,4 @@ +from ..const import DEVICE_DESCRIPTOR_PROPERTIES, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_ON, PROPERTY_STATUS_VALUE_OFF from .device import CoCoDevice import logging @@ -7,20 +8,20 @@ class CocoRelayAction(CoCoDevice): @property - def status_status(self) -> str: - return self.extract_property_value('Status') + def status(self) -> str: + return self.extract_property_value(PROPERTY_STATUS) def on_change(self, topic: str, payload: dict): _LOGGER.debug(f'{self.name} changed. Topic: {topic} | Data: {payload}') - if 'Properties' in payload: - self.merge_properties(payload['Properties']) + if DEVICE_DESCRIPTOR_PROPERTIES in payload: + self.merge_properties(payload[DEVICE_DESCRIPTOR_PROPERTIES]) if self._after_change_callbacks: for callback in self._after_change_callbacks: callback() def turn_on(self, gateway): - gateway._add_device_control(self.uuid, "Status", "On") + gateway._add_device_control(self.uuid, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_ON) def turn_off(self, gateway): - gateway._add_device_control(self.uuid, "Status", "Off") + gateway._add_device_control(self.uuid, PROPERTY_STATUS, PROPERTY_STATUS_VALUE_OFF) diff --git a/custom_components/nhc2/nhccoco/devices/socket_action.py b/custom_components/nhc2/nhccoco/devices/socket_action.py index 09fe3351..07dc0de3 100644 --- a/custom_components/nhc2/nhccoco/devices/socket_action.py +++ b/custom_components/nhc2/nhccoco/devices/socket_action.py @@ -1,7 +1,8 @@ +from ..const import PROPERTY_STATUS_VALUE_ON from .relay_action import CocoRelayAction class CocoSocketAction(CocoRelayAction): @property def is_on(self) -> bool: - return self.status_status == 'On' + return self.status == PROPERTY_STATUS_VALUE_ON diff --git a/custom_components/nhc2/nhccoco/devices/switched_fan_action.py b/custom_components/nhc2/nhccoco/devices/switched_fan_action.py index a27ff991..1fd20671 100644 --- a/custom_components/nhc2/nhccoco/devices/switched_fan_action.py +++ b/custom_components/nhc2/nhccoco/devices/switched_fan_action.py @@ -1,7 +1,8 @@ +from ..const import PROPERTY_STATUS_VALUE_ON from .relay_action import CocoRelayAction class CocoSwitchedFanAction(CocoRelayAction): @property def is_on(self) -> bool: - return self.status_status == 'On' + return self.status == PROPERTY_STATUS_VALUE_ON diff --git a/custom_components/nhc2/nhccoco/devices/switched_generic_action.py b/custom_components/nhc2/nhccoco/devices/switched_generic_action.py index 297d89e7..88785539 100644 --- a/custom_components/nhc2/nhccoco/devices/switched_generic_action.py +++ b/custom_components/nhc2/nhccoco/devices/switched_generic_action.py @@ -1,7 +1,8 @@ +from ..const import PROPERTY_STATUS_VALUE_ON from .relay_action import CocoRelayAction class CocoSwitchedGenericAction(CocoRelayAction): @property def is_on(self) -> bool: - return self.status_status == 'On' + return self.status == PROPERTY_STATUS_VALUE_ON