not working shorthand

This commit is contained in:
Taraman17 2025-02-07 14:27:48 +00:00
parent ed2b14ef2f
commit e3dd726e24

View File

@ -99,17 +99,13 @@ class HomeeSwitch(HomeeEntity, SwitchEntity):
"""Initialize a Homee switch entity."""
super().__init__(attribute, entry)
self.entity_description = description
self._attr_is_on = bool(attribute.current_value)
if not ((attribute.type == AttributeType.ON_OFF) and (attribute.instance == 0)):
self._attr_translation_key = description.key
if attribute.instance > 0:
self._attr_translation_key = f"{description.key}_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
def device_class(self) -> SwitchDeviceClass:
"""Return the device class of the switch."""