1 """Support for EnOcean binary sensors."""
3 from __future__
import annotations
5 from enocean.utils
import combine_hex
6 import voluptuous
as vol
10 PLATFORM_SCHEMA
as BINARY_SENSOR_PLATFORM_SCHEMA,
11 BinarySensorDeviceClass,
20 from .entity
import EnOceanEntity
22 DEFAULT_NAME =
"EnOcean binary sensor"
23 DEPENDENCIES = [
"enocean"]
24 EVENT_BUTTON_PRESSED =
"button_pressed"
26 PLATFORM_SCHEMA = BINARY_SENSOR_PLATFORM_SCHEMA.extend(
28 vol.Required(CONF_ID): vol.All(cv.ensure_list, [vol.Coerce(int)]),
29 vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
30 vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA,
38 add_entities: AddEntitiesCallback,
39 discovery_info: DiscoveryInfoType |
None =
None,
41 """Set up the Binary Sensor platform for EnOcean."""
42 dev_id: list[int] = config[CONF_ID]
43 dev_name: str = config[CONF_NAME]
44 device_class: BinarySensorDeviceClass |
None = config.get(CONF_DEVICE_CLASS)
50 """Representation of EnOcean binary sensors such as wall switches.
52 Supported EEPs (EnOcean Equipment Profiles):
53 - F6-02-01 (Light and Blind Control - Application Style 2)
54 - F6-02-02 (Light and Blind Control - Application Style 1)
61 device_class: BinarySensorDeviceClass |
None,
63 """Initialize the EnOcean binary sensor."""
72 """Fire an event with the data that have changed.
74 This method is called when there is an incoming packet associated
79 ['0xf6', '0x10', '0x00', '0x2d', '0xcf', '0x45', '0x30']
81 ['0xf6', '0x00', '0x00', '0x2d', '0xcf', '0x45', '0x20']
86 if packet.data[6] == 0x30:
88 elif packet.data[6] == 0x20:
93 action = packet.data[1]
112 self.
hasshass.bus.fire(
113 EVENT_BUTTON_PRESSED,
117 "which": self.
whichwhich,
118 "onoff": self.
onoffonoff,
def value_changed(self, packet)
None __init__(self, list[int] dev_id, str dev_name, BinarySensorDeviceClass|None device_class)
None schedule_update_ha_state(self, bool force_refresh=False)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)