Added type information to lupusec (#109004)
Co-authored-by: suaveolent <suaveolent@users.noreply.github.com>
This commit is contained in:
parent
6ef0b9bf97
commit
5818b6141a
5 changed files with 23 additions and 30 deletions
|
@ -34,8 +34,8 @@ async def async_setup_entry(
|
|||
device_types = CONST.TYPE_OPENING + CONST.TYPE_SENSOR
|
||||
|
||||
sensors = []
|
||||
for device in data.lupusec.get_devices(generic_type=device_types):
|
||||
sensors.append(LupusecBinarySensor(data, device, config_entry.entry_id))
|
||||
for device in data.get_devices(generic_type=device_types):
|
||||
sensors.append(LupusecBinarySensor(device, config_entry.entry_id))
|
||||
|
||||
async_add_devices(sensors)
|
||||
|
||||
|
@ -46,12 +46,12 @@ class LupusecBinarySensor(LupusecBaseSensor, BinarySensorEntity):
|
|||
_attr_name = None
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
def is_on(self) -> bool:
|
||||
"""Return True if the binary sensor is on."""
|
||||
return self._device.is_on
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
def device_class(self) -> BinarySensorDeviceClass | None:
|
||||
"""Return the class of the binary sensor."""
|
||||
if self._device.generic_type not in (
|
||||
item.value for item in BinarySensorDeviceClass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue