"""Neustart-Knopf fuer ein ninstrip-Geraet.""" from __future__ import annotations from homeassistant.components.button import ButtonDeviceClass, ButtonEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .coordinator import NinstripConfigEntry, NinstripCoordinator from .entity import NinstripEntity async def async_setup_entry( hass: HomeAssistant, entry: NinstripConfigEntry, async_add_entities: AddConfigEntryEntitiesCallback, ) -> None: async_add_entities([NinstripRestartButton(entry.runtime_data)]) class NinstripRestartButton(NinstripEntity, ButtonEntity): _attr_device_class = ButtonDeviceClass.RESTART _attr_entity_category = EntityCategory.CONFIG _attr_translation_key = "restart" def __init__(self, coordinator: NinstripCoordinator) -> None: super().__init__(coordinator, "restart") async def async_press(self) -> None: await self.coordinator.async_call(lambda client: client.reboot())