mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Add icon translations to TP-Link (#112317)
This commit is contained in:
parent
98fa4b3d3c
commit
c8a30cfda7
16
homeassistant/components/tplink/icons.json
Normal file
16
homeassistant/components/tplink/icons.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"entity": {
|
||||
"switch": {
|
||||
"led": {
|
||||
"default": "mdi:led-off",
|
||||
"state": {
|
||||
"on": "mdi:led-on"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"sequence_effect": "mdi:playlist-play",
|
||||
"random_effect": "mdi:shuffle-variant"
|
||||
}
|
||||
}
|
@ -61,7 +61,7 @@ class SmartPlugLedSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
||||
) -> None:
|
||||
"""Initialize the LED switch."""
|
||||
super().__init__(device, coordinator)
|
||||
self._attr_unique_id = f"{self.device.mac}_led"
|
||||
self._attr_unique_id = f"{device.mac}_led"
|
||||
self._async_update_attrs()
|
||||
|
||||
@async_refresh_after
|
||||
@ -77,9 +77,7 @@ class SmartPlugLedSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
||||
@callback
|
||||
def _async_update_attrs(self) -> None:
|
||||
"""Update the entity's attributes."""
|
||||
is_on = self.device.led
|
||||
self._attr_is_on = is_on
|
||||
self._attr_icon = "mdi:led-on" if is_on else "mdi:led-off"
|
||||
self._attr_is_on = self.device.led
|
||||
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user