mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 09:38:21 +00:00
revert is_on
This commit is contained in:
parent
e3dd726e24
commit
096891fc84
@ -99,13 +99,17 @@ class HomeeSwitch(HomeeEntity, SwitchEntity):
|
|||||||
"""Initialize a Homee switch entity."""
|
"""Initialize a Homee switch entity."""
|
||||||
super().__init__(attribute, entry)
|
super().__init__(attribute, entry)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_is_on = bool(attribute.current_value)
|
|
||||||
if not ((attribute.type == AttributeType.ON_OFF) and (attribute.instance == 0)):
|
if not ((attribute.type == AttributeType.ON_OFF) and (attribute.instance == 0)):
|
||||||
self._attr_translation_key = description.key
|
self._attr_translation_key = description.key
|
||||||
if attribute.instance > 0:
|
if attribute.instance > 0:
|
||||||
self._attr_translation_key = f"{description.key}_instance"
|
self._attr_translation_key = f"{description.key}_instance"
|
||||||
self._attr_translation_placeholders = {"instance": str(attribute.instance)}
|
self._attr_translation_placeholders = {"instance": str(attribute.instance)}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self) -> bool:
|
||||||
|
"""Return True if entity is on."""
|
||||||
|
return bool(self._attribute.current_value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self) -> SwitchDeviceClass:
|
def device_class(self) -> SwitchDeviceClass:
|
||||||
"""Return the device class of the switch."""
|
"""Return the device class of the switch."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user