Home Assistant Unofficial Reference
2024.12.1
button.py
Go to the documentation of this file.
1
"""Support for August 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
AugustConfigEntry
8
from
.entity
import
AugustEntity
9
10
11
async
def
async_setup_entry
(
12
hass: HomeAssistant,
13
config_entry: AugustConfigEntry,
14
async_add_entities: AddEntitiesCallback,
15
) ->
None
:
16
"""Set up August lock wake buttons."""
17
data = config_entry.runtime_data
18
async_add_entities
(
AugustWakeLockButton
(data, lock,
"wake"
)
for
lock
in
data.locks)
19
20
21
class
AugustWakeLockButton
(
AugustEntity
,
ButtonEntity
):
22
"""Representation of an August 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."""
homeassistant.components.august.button.AugustWakeLockButton
Definition:
button.py:21
homeassistant.components.august.button.AugustWakeLockButton._update_from_data
None _update_from_data(self)
Definition:
button.py:31
homeassistant.components.august.button.AugustWakeLockButton.async_press
None async_press(self)
Definition:
button.py:26
homeassistant.components.august.entity.AugustEntity
Definition:
entity.py:23
homeassistant.components.august.entity.AugustEntity._hyper_bridge
bool _hyper_bridge(self)
Definition:
entity.py:57
homeassistant.components.august.entity.AugustEntity._data
_data
Definition:
entity.py:34
homeassistant.components.august.entity.AugustEntity._device_id
_device_id
Definition:
entity.py:38
homeassistant.components.button.ButtonEntity
Definition:
__init__.py:87
homeassistant.components.august.button.async_setup_entry
None async_setup_entry(HomeAssistant hass, AugustConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Definition:
button.py:15
homeassistant.components.button
Definition:
__init__.py:1
homeassistant.components.mysensors.sensor.async_add_entities
async_add_entities
Definition:
sensor.py:224
homeassistant.core
Definition:
core.py:1
homeassistant.helpers.entity_platform
Definition:
entity_platform.py:1
core
homeassistant
components
august
button.py
Generated by
1.9.1