1 """Button entity for LIFX devices.."""
3 from __future__
import annotations
8 ButtonEntityDescription,
15 from .const
import DOMAIN, IDENTIFY, RESTART
16 from .coordinator
import LIFXUpdateCoordinator
17 from .entity
import LIFXEntity
21 device_class=ButtonDeviceClass.RESTART,
22 entity_category=EntityCategory.CONFIG,
27 device_class=ButtonDeviceClass.IDENTIFY,
28 entity_category=EntityCategory.CONFIG,
35 async_add_entities: AddEntitiesCallback,
37 """Set up LIFX from a config entry."""
38 domain_data = hass.data[DOMAIN]
39 coordinator: LIFXUpdateCoordinator = domain_data[entry.entry_id]
46 """Base LIFX button."""
48 _attr_should_poll =
False
50 def __init__(self, coordinator: LIFXUpdateCoordinator) ->
None:
51 """Initialise a LIFX button."""
54 f
"{coordinator.serial_number}_{self.entity_description.key}"
59 """LIFX restart button."""
61 entity_description = RESTART_BUTTON_DESCRIPTION
64 """Restart the bulb on button press."""
65 self.
bulbbulb.set_reboot()
69 """LIFX identify button."""
71 entity_description = IDENTIFY_BUTTON_DESCRIPTION
74 """Identify the bulb by flashing it when the button is pressed."""
None async_identify_bulb(self)