mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
address review comments
This commit is contained in:
parent
34f1e720f6
commit
0e2913c7e9
@ -67,7 +67,7 @@ async def async_setup_entry(
|
|||||||
config_entry: HomeeConfigEntry,
|
config_entry: HomeeConfigEntry,
|
||||||
async_add_devices: AddConfigEntryEntitiesCallback,
|
async_add_devices: AddConfigEntryEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Setups the switch platform for the Homee component."""
|
"""Set up the switch platform for the Homee component."""
|
||||||
|
|
||||||
for node in config_entry.runtime_data.nodes:
|
for node in config_entry.runtime_data.nodes:
|
||||||
async_add_devices(
|
async_add_devices(
|
||||||
@ -99,9 +99,12 @@ 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
|
||||||
if not (attribute.type == AttributeType.ON_OFF and attribute.instance == 0):
|
if attribute.instance == 0:
|
||||||
|
if attribute.type == AttributeType.ON_OFF:
|
||||||
|
self._attr_name = None
|
||||||
|
else:
|
||||||
self._attr_translation_key = description.key
|
self._attr_translation_key = description.key
|
||||||
if attribute.instance > 0:
|
else:
|
||||||
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)}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user