1 """Support for SwitchBot binary sensors."""
3 from __future__
import annotations
6 BinarySensorDeviceClass,
8 BinarySensorEntityDescription,
14 from .coordinator
import SwitchbotConfigEntry, SwitchbotDataUpdateCoordinator
15 from .entity
import SwitchbotEntity
19 BINARY_SENSOR_TYPES: dict[str, BinarySensorEntityDescription] = {
22 translation_key=
"calibration",
23 entity_category=EntityCategory.DIAGNOSTIC,
28 device_class=BinarySensorDeviceClass.MOTION,
33 device_class=BinarySensorDeviceClass.DOOR,
36 key=
"contact_timeout",
37 translation_key=
"door_timeout",
38 device_class=BinarySensorDeviceClass.PROBLEM,
39 entity_category=EntityCategory.DIAGNOSTIC,
43 device_class=BinarySensorDeviceClass.LIGHT,
48 device_class=BinarySensorDeviceClass.DOOR,
52 translation_key=
"door_unclosed_alarm",
53 entity_category=EntityCategory.DIAGNOSTIC,
54 device_class=BinarySensorDeviceClass.PROBLEM,
58 translation_key=
"door_unlocked_alarm",
59 entity_category=EntityCategory.DIAGNOSTIC,
60 device_class=BinarySensorDeviceClass.PROBLEM,
63 key=
"auto_lock_paused",
64 translation_key=
"door_auto_lock_paused",
65 entity_category=EntityCategory.DIAGNOSTIC,
72 entry: SwitchbotConfigEntry,
73 async_add_entities: AddEntitiesCallback,
75 """Set up Switchbot curtain based on a config entry."""
76 coordinator = entry.runtime_data
79 for binary_sensor
in coordinator.device.parsed_data
80 if binary_sensor
in BINARY_SENSOR_TYPES
85 """Representation of a Switchbot binary sensor."""
89 coordinator: SwitchbotDataUpdateCoordinator,
92 """Initialize the Switchbot sensor."""
100 """Return the state of the sensor."""
None __init__(self, SwitchbotDataUpdateCoordinator coordinator, str binary_sensor)
dict[str, Any] parsed_data(self)
None async_setup_entry(HomeAssistant hass, SwitchbotConfigEntry entry, AddEntitiesCallback async_add_entities)