1 """Support for Lupusec Security System binary sensors."""
3 from __future__
import annotations
5 from datetime
import timedelta
6 from functools
import partial
9 import lupupy.constants
as CONST
12 BinarySensorDeviceClass,
20 from .entity
import LupusecBaseSensor
24 _LOGGER = logging.getLogger(__name__)
29 config_entry: ConfigEntry,
30 async_add_entities: AddEntitiesCallback,
32 """Set up a binary sensors for a Lupusec device."""
34 data = hass.data[DOMAIN][config_entry.entry_id]
36 device_types = CONST.TYPE_OPENING + CONST.TYPE_SENSOR
38 partial_func = partial(data.get_devices, generic_type=device_types)
39 devices = await hass.async_add_executor_job(partial_func)
47 """A binary sensor implementation for Lupusec device."""
53 """Return True if the binary sensor is on."""
54 return self.
_device_device.is_on
58 """Return the class of the binary sensor."""
59 if self.
_device_device.generic_type
not in (
60 item.value
for item
in BinarySensorDeviceClass
63 return self.
_device_device.generic_type
BinarySensorDeviceClass|None device_class(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)