1 """Representation of a sensorBinary."""
3 from __future__
import annotations
5 from zwave_me_ws
import ZWaveMeData
8 BinarySensorDeviceClass,
10 BinarySensorEntityDescription,
17 from .
import ZWaveMeController
18 from .const
import DOMAIN, ZWaveMePlatform
19 from .entity
import ZWaveMeEntity
21 BINARY_SENSORS_MAP: dict[str, BinarySensorEntityDescription] = {
27 device_class=BinarySensorDeviceClass.MOTION,
30 DEVICE_NAME = ZWaveMePlatform.BINARY_SENSOR
35 config_entry: ConfigEntry,
36 async_add_entities: AddEntitiesCallback,
38 """Set up the binary sensor platform."""
42 controller: ZWaveMeController = hass.data[DOMAIN][config_entry.entry_id]
43 description = BINARY_SENSORS_MAP.get(
44 new_device.probeType, BINARY_SENSORS_MAP[
"generic"]
54 config_entry.async_on_unload(
56 hass, f
"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
62 """Representation of a ZWaveMe binary sensor."""
66 controller: ZWaveMeController,
68 description: BinarySensorEntityDescription,
70 """Initialize the device."""
71 super().
__init__(controller=controller, device=device)
76 """Return the state of the sensor."""
77 return self.
devicedevice.level ==
"on"
None __init__(self, ZWaveMeController controller, ZWaveMeData device, BinarySensorEntityDescription description)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
def add_new_device(new_device)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)