Create a binary sensor for each Duotecno virtual unit (#102347)
parent
da653c36fd
commit
5e483c5573
|
@ -1,6 +1,6 @@
|
|||
"""Support for Duotecno binary sensors."""
|
||||
|
||||
from duotecno.unit import ControlUnit
|
||||
from duotecno.unit import ControlUnit, VirtualUnit
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -19,14 +19,15 @@ async def async_setup_entry(
|
|||
"""Set up Duotecno binary sensor on config_entry."""
|
||||
cntrl = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities(
|
||||
DuotecnoBinarySensor(channel) for channel in cntrl.get_units("ControlUnit")
|
||||
DuotecnoBinarySensor(channel)
|
||||
for channel in cntrl.get_units(["ControlUnit", "VirtualUnit"])
|
||||
)
|
||||
|
||||
|
||||
class DuotecnoBinarySensor(DuotecnoEntity, BinarySensorEntity):
|
||||
"""Representation of a DuotecnoBinarySensor."""
|
||||
|
||||
_unit: ControlUnit
|
||||
_unit: ControlUnit | VirtualUnit
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
|
Loading…
Reference in New Issue