Home Assistant Unofficial Reference 2024.12.1
button.py
Go to the documentation of this file.
1 """Support for Yale buttons."""
2 
3 from homeassistant.components.button import ButtonEntity
4 from homeassistant.core import HomeAssistant, callback
5 from homeassistant.helpers.entity_platform import AddEntitiesCallback
6 
7 from . import YaleConfigEntry
8 from .entity import YaleEntity
9 
10 
12  hass: HomeAssistant,
13  config_entry: YaleConfigEntry,
14  async_add_entities: AddEntitiesCallback,
15 ) -> None:
16  """Set up Yale lock wake buttons."""
17  data = config_entry.runtime_data
18  async_add_entities(YaleWakeLockButton(data, lock, "wake") for lock in data.locks)
19 
20 
22  """Representation of an Yale lock wake button."""
23 
24  _attr_translation_key = "wake"
25 
26  async def async_press(self) -> None:
27  """Wake the device."""
28  await self._data_data.async_status_async(self._device_id_device_id, self._hyper_bridge_hyper_bridge)
29 
30  @callback
31  def _update_from_data(self) -> None:
32  """Nothing to update as buttons are stateless."""
None async_setup_entry(HomeAssistant hass, YaleConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Definition: button.py:15