hass-livebox-component icon indicating copy to clipboard operation
hass-livebox-component copied to clipboard

[request] Add "turn off LED" button

Open alexandreaudrain opened this issue 1 week ago • 0 comments

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.

alexandreaudrain avatar Feb 14 '25 21:02 alexandreaudrain