mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00

* Split august and yale integrations [part 1] (#122253) * merge with dev * Remove unused constant * Remove yale IPv6 workaround (#123409) * Convert yale to use oauth (#123806) Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update yale for switch from pubnub to websockets (#124675) --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
33 lines
1010 B
Python
33 lines
1010 B
Python
"""Support for Yale buttons."""
|
|
|
|
from homeassistant.components.button import ButtonEntity
|
|
from homeassistant.core import HomeAssistant, callback
|
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|
|
|
from . import YaleConfigEntry
|
|
from .entity import YaleEntityMixin
|
|
|
|
|
|
async def async_setup_entry(
|
|
hass: HomeAssistant,
|
|
config_entry: YaleConfigEntry,
|
|
async_add_entities: AddEntitiesCallback,
|
|
) -> None:
|
|
"""Set up Yale lock wake buttons."""
|
|
data = config_entry.runtime_data
|
|
async_add_entities(YaleWakeLockButton(data, lock, "wake") for lock in data.locks)
|
|
|
|
|
|
class YaleWakeLockButton(YaleEntityMixin, ButtonEntity):
|
|
"""Representation of an Yale lock wake button."""
|
|
|
|
_attr_translation_key = "wake"
|
|
|
|
async def async_press(self) -> None:
|
|
"""Wake the device."""
|
|
await self._data.async_status_async(self._device_id, self._hyper_bridge)
|
|
|
|
@callback
|
|
def _update_from_data(self) -> None:
|
|
"""Nothing to update as buttons are stateless."""
|