Library refactorization of deCONZ (#23725)

* Improved sensors

* Lib update signalling

* Replace reason with changed

* Move imports to top of file

* Add support for secondary temperature reported by some Xiaomi devices

* Bump dependency to v59
This commit is contained in:
Robert Svensson authored and GitHub committed 2019-05-27 06:56:00 +02:00
1 parent 0ba54ee9b7
commit 31b2f331db
19 files changed
+104 -83

No files matched your search

+10 -3
View File
@@ -1,4 +1,6 @@
"""Support for deCONZ climate devices."""
from pydeconz.sensor import Thermostat
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_ON_OFF, SUPPORT_TARGET_TEMPERATURE)
@@ -12,6 +14,12 @@ from .deconz_device import DeconzDevice
from .gateway import get_gateway_from_config_entry
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
"""Old way of setting up deCONZ platforms."""
pass
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the deCONZ climate devices.
@@ -22,12 +30,11 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
@callback
def async_add_climate(sensors):
"""Add climate devices from deCONZ."""
from pydeconz.sensor import THERMOSTAT
entities = []
for sensor in sensors:
if sensor.type in THERMOSTAT and \
if sensor.type in Thermostat.ZHATYPE and \
not (not gateway.allow_clip_sensor and
sensor.type.startswith('CLIP')):
@@ -59,7 +66,7 @@ class DeconzThermostat(DeconzDevice, ClimateDevice):
@property
def is_on(self):
"""Return true if on."""
return self._device.on
return self._device.state_on
async def async_turn_on(self):
"""Turn on switch."""