1 """Plugwise Button component for Home Assistant."""
3 from __future__
import annotations
10 from .
import PlugwiseConfigEntry
11 from .const
import GATEWAY_ID, REBOOT
12 from .coordinator
import PlugwiseDataUpdateCoordinator
13 from .entity
import PlugwiseEntity
14 from .util
import plugwise_command
19 entry: PlugwiseConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Set up the Plugwise buttons from a ConfigEntry."""
23 coordinator = entry.runtime_data
25 gateway = coordinator.data.gateway
28 for device_id
in coordinator.data.devices
29 if device_id == gateway[GATEWAY_ID]
and REBOOT
in gateway
34 """Defines a Plugwise button."""
36 _attr_device_class = ButtonDeviceClass.RESTART
37 _attr_entity_category = EntityCategory.CONFIG
41 coordinator: PlugwiseDataUpdateCoordinator,
44 """Initialize the button."""
45 super().
__init__(coordinator, device_id)
51 """Triggers the Plugwise button press service."""
52 await self.coordinator.api.reboot_gateway()