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:
Robert Svensson 2020-01-03 15:15:32 +01:00 committed by GitHub
parent 0d5486f772
commit 536b201472
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View file

@ -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)