1 """Support for ZHA button."""
3 from __future__
import annotations
15 from .entity
import ZHAEntity
16 from .helpers
import (
19 async_add_entities
as zha_async_add_entities,
20 convert_zha_error_to_ha_error,
24 _LOGGER = logging.getLogger(__name__)
29 config_entry: ConfigEntry,
30 async_add_entities: AddEntitiesCallback,
32 """Set up the Zigbee Home Automation button from config entry."""
34 entities_to_create = zha_data.platforms[Platform.BUTTON]
40 zha_async_add_entities, async_add_entities, ZHAButton, entities_to_create
43 config_entry.async_on_unload(unsub)
47 """Defines a ZHA button."""
49 def __init__(self, entity_data: EntityData) ->
None:
50 """Initialize the ZHA binary sensor."""
52 if self.entity_data.entity.info_object.device_class
is not None:
54 self.entity_data.entity.info_object.device_class
57 @convert_zha_error_to_ha_error
59 """Send out a update command."""
60 await self.entity_data.entity.async_press()
HAZHAData get_zha_data(HomeAssistant hass)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)