mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 10:08:23 +00:00
fix review pt1
This commit is contained in:
parent
ad3f17634f
commit
ed2b14ef2f
@ -154,10 +154,10 @@
|
|||||||
},
|
},
|
||||||
"switch": {
|
"switch": {
|
||||||
"external_binary_input": {
|
"external_binary_input": {
|
||||||
"name": "Child Lock"
|
"name": "Child lock"
|
||||||
},
|
},
|
||||||
"manual_operation": {
|
"manual_operation": {
|
||||||
"name": "Manual Operation"
|
"name": "Manual operation"
|
||||||
},
|
},
|
||||||
"on_off_instance": {
|
"on_off_instance": {
|
||||||
"name": "Switch {instance}"
|
"name": "Switch {instance}"
|
||||||
|
@ -69,9 +69,8 @@ async def async_setup_entry(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Add the Homee platform for the switch component."""
|
"""Add the Homee platform for the switch component."""
|
||||||
|
|
||||||
devices: list[HomeeSwitch] = []
|
|
||||||
for node in config_entry.runtime_data.nodes:
|
for node in config_entry.runtime_data.nodes:
|
||||||
devices.extend(
|
async_add_devices(
|
||||||
HomeeSwitch(attribute, config_entry, SWITCH_DESCRIPTIONS[attribute.type])
|
HomeeSwitch(attribute, config_entry, SWITCH_DESCRIPTIONS[attribute.type])
|
||||||
for attribute in node.attributes
|
for attribute in node.attributes
|
||||||
if (attribute.type in SWITCH_DESCRIPTIONS and attribute.editable)
|
if (attribute.type in SWITCH_DESCRIPTIONS and attribute.editable)
|
||||||
@ -84,8 +83,6 @@ async def async_setup_entry(
|
|||||||
and node.profile in CLIMATE_PROFILES
|
and node.profile in CLIMATE_PROFILES
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if devices:
|
|
||||||
async_add_devices(devices)
|
|
||||||
|
|
||||||
|
|
||||||
class HomeeSwitch(HomeeEntity, SwitchEntity):
|
class HomeeSwitch(HomeeEntity, SwitchEntity):
|
||||||
@ -102,7 +99,6 @@ 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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user