mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Velbus light platform code cleanup (#134482)
This commit is contained in:
parent
a2d9920aa9
commit
033064f832
@ -122,19 +122,14 @@ class VelbusButtonLight(VelbusEntity, LightEntity):
|
|||||||
@api_call
|
@api_call
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Instruct the Velbus light to turn on."""
|
"""Instruct the Velbus light to turn on."""
|
||||||
if ATTR_FLASH in kwargs:
|
if (flash := ATTR_FLASH in kwargs) and kwargs[ATTR_FLASH] == FLASH_LONG:
|
||||||
if kwargs[ATTR_FLASH] == FLASH_LONG:
|
await self._channel.set_led_state("slow")
|
||||||
attr, *args = "set_led_state", "slow"
|
elif flash and kwargs[ATTR_FLASH] == FLASH_SHORT:
|
||||||
elif kwargs[ATTR_FLASH] == FLASH_SHORT:
|
await self._channel.set_led_state("fast")
|
||||||
attr, *args = "set_led_state", "fast"
|
|
||||||
else:
|
|
||||||
attr, *args = "set_led_state", "on"
|
|
||||||
else:
|
else:
|
||||||
attr, *args = "set_led_state", "on"
|
await self._channel.set_led_state("on")
|
||||||
await getattr(self._channel, attr)(*args)
|
|
||||||
|
|
||||||
@api_call
|
@api_call
|
||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Instruct the velbus light to turn off."""
|
"""Instruct the velbus light to turn off."""
|
||||||
attr, *args = "set_led_state", "off"
|
await self._channel.set_led_state("off")
|
||||||
await getattr(self._channel, attr)(*args)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user