From 536b201472d9aa964af21ce63700876a1e7505f8 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Fri, 3 Jan 2020 15:15:32 +0100 Subject: [PATCH] WIP deCONZ - Support Fyrtur/Kadrilj battery sensors (#30403) * Sensor.binary is None means unsupported sensor * Don't create ordinary sensor on ZHABattery type --- homeassistant/components/deconz/manifest.json | 2 +- homeassistant/components/deconz/sensor.py | 16 ++++++++++++++-- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/deconz/manifest.json b/homeassistant/components/deconz/manifest.json index 402244fbc13..fec3a7cc42b 100644 --- a/homeassistant/components/deconz/manifest.json +++ b/homeassistant/components/deconz/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/deconz", "requirements": [ - "pydeconz==66" + "pydeconz==67" ], "ssdp": [ { diff --git a/homeassistant/components/deconz/sensor.py b/homeassistant/components/deconz/sensor.py index 4ffaba9b499..272c7a85ceb 100644 --- a/homeassistant/components/deconz/sensor.py +++ b/homeassistant/components/deconz/sensor.py @@ -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) diff --git a/requirements_all.txt b/requirements_all.txt index cae0b22bd42..7c81758e7ec 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1191,7 +1191,7 @@ pydaikin==1.6.1 pydanfossair==0.1.0 # homeassistant.components.deconz -pydeconz==66 +pydeconz==67 # homeassistant.components.delijn pydelijn==0.5.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ab2519af8cc..80150c21a95 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -411,7 +411,7 @@ pycoolmasternet==0.0.4 pydaikin==1.6.1 # homeassistant.components.deconz -pydeconz==66 +pydeconz==67 # homeassistant.components.zwave pydispatcher==2.0.5