hass-livebox-component
hass-livebox-component copied to clipboard
[request] Add "turn off LED" button
Hi.
Thanks a lot for your hard work !
I have a Livebox 6 and want to turn off orange led during evening. It's quite easy through AIOSYSBUS => autodiag => async_run_diags with parameter : {"id": "refurbishledOFF"}
I added this code to button.py, which just works fine (but might be improved : I'm Python newbie...) :
BUTTON_TYPES: Final[tuple[ButtonEntityDescription, ...]] = (
...
LiveboxButtonEntityDescription(
key="led",
name="Shut down LED",
icon=LED_ICON,
translation_key="led_btn",
value_fn=lambda x: getattr(getattr(x, "autodiag"), "async_run_diags"),
),
)
...
async def async_press(self) -> None:
"""Triggers the button press service."""
**if self.entity_description.key == "led":
await self.entity_description.value_fn(self.coordinator.api)({"id": "refurbishledOFF"})
else:**
await self.entity_description.value_fn(self.coordinator.api)()
Would you mind adding this feature to your code ?
After that, since LED turns on again after 2 minutes, I just created an automation in Home Assistant.