WIP deCONZ - Support Fyrtur/Kadrilj battery sensors (#30403)
* Sensor.binary is None means unsupported sensor * Don't create ordinary sensor on ZHABattery type
This commit is contained in:
parent
0d5486f772
commit
536b201472
4 changed files with 17 additions and 5 deletions
|
@ -1,5 +1,13 @@
|
|||
"""Support for deCONZ sensors."""
|
||||
from pydeconz.sensor import Consumption, Daylight, LightLevel, Power, Switch, Thermostat
|
||||
from pydeconz.sensor import (
|
||||
Battery,
|
||||
Consumption,
|
||||
Daylight,
|
||||
LightLevel,
|
||||
Power,
|
||||
Switch,
|
||||
Thermostat,
|
||||
)
|
||||
|
||||
from homeassistant.const import ATTR_TEMPERATURE, ATTR_VOLTAGE, DEVICE_CLASS_BATTERY
|
||||
from homeassistant.core import callback
|
||||
|
@ -53,7 +61,11 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
hass.async_create_task(new_event.async_update_device_registry())
|
||||
gateway.events.append(new_event)
|
||||
|
||||
elif new and not sensor.BINARY and sensor.type not in Thermostat.ZHATYPE:
|
||||
elif (
|
||||
new
|
||||
and sensor.BINARY is False
|
||||
and sensor.type not in Battery.ZHATYPE + Thermostat.ZHATYPE
|
||||
):
|
||||
|
||||
new_sensor = DeconzSensor(sensor, gateway)
|
||||
entity_handler.add_entity(new_sensor)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue