fix review pt1

This commit is contained in:
Taraman17 2025-02-07 12:55:40 +00:00
parent ad3f17634f
commit ed2b14ef2f
2 changed files with 3 additions and 7 deletions

View File

@ -154,10 +154,10 @@
},
"switch": {
"external_binary_input": {
"name": "Child Lock"
"name": "Child lock"
},
"manual_operation": {
"name": "Manual Operation"
"name": "Manual operation"
},
"on_off_instance": {
"name": "Switch {instance}"

View File

@ -69,9 +69,8 @@ async def async_setup_entry(
) -> None:
"""Add the Homee platform for the switch component."""
devices: list[HomeeSwitch] = []
for node in config_entry.runtime_data.nodes:
devices.extend(
async_add_devices(
HomeeSwitch(attribute, config_entry, SWITCH_DESCRIPTIONS[attribute.type])
for attribute in node.attributes
if (attribute.type in SWITCH_DESCRIPTIONS and attribute.editable)
@ -84,8 +83,6 @@ async def async_setup_entry(
and node.profile in CLIMATE_PROFILES
)
)
if devices:
async_add_devices(devices)
class HomeeSwitch(HomeeEntity, SwitchEntity):
@ -102,7 +99,6 @@ 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: