1 """Support for KNX/IP buttons."""
3 from __future__
import annotations
5 from xknx.devices
import RawValue
as XknxRawValue
7 from homeassistant
import config_entries
14 from .
import KNXModule
15 from .const
import CONF_PAYLOAD_LENGTH, KNX_ADDRESS, KNX_MODULE_KEY
16 from .entity
import KnxYamlEntity
22 async_add_entities: AddEntitiesCallback,
24 """Set up the KNX binary sensor platform."""
25 knx_module = hass.data[KNX_MODULE_KEY]
26 config: list[ConfigType] = knx_module.config_yaml[Platform.BUTTON]
32 """Representation of a KNX button."""
36 def __init__(self, knx_module: KNXModule, config: ConfigType) ->
None:
37 """Initialize a KNX button."""
39 knx_module=knx_module,
42 name=config[CONF_NAME],
43 payload_length=config[CONF_PAYLOAD_LENGTH],
44 group_address=config[KNX_ADDRESS],
50 f
"{self._device.remote_value.group_address}_{self._payload}"
54 """Press the button."""