Add deCONZ entities in a predicitive order (#11712)

* Make sure that entities names are created in a predicitive order

* Debug print for deconz config parameters

* Bump requirement to v25
This commit is contained in:
Kane610 2018-01-18 06:22:42 +01:00 committed by Paulus Schoutsen
parent aac01cb096
commit 8bcaf832ae
4 changed files with 9 additions and 6 deletions

View File

@ -25,8 +25,9 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
sensors = hass.data[DECONZ_DATA].sensors
entities = []
for sensor in sensors.values():
if sensor.type in DECONZ_BINARY_SENSOR:
for key in sorted(sensors.keys(), key=int):
sensor = sensors[key]
if sensor and sensor.type in DECONZ_BINARY_SENSOR:
entities.append(DeconzBinarySensor(sensor))
async_add_devices(entities, True)

View File

@ -17,7 +17,7 @@ from homeassistant.helpers import discovery
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.util.json import load_json, save_json
REQUIREMENTS = ['pydeconz==24']
REQUIREMENTS = ['pydeconz==25']
_LOGGER = logging.getLogger(__name__)
@ -90,6 +90,7 @@ def async_setup_deconz(hass, config, deconz_config):
Load config, group, light and sensor data for server information.
Start websocket for push notification of state changes from deCONZ.
"""
_LOGGER.debug('deCONZ config %s', deconz_config)
from pydeconz import DeconzSession
websession = async_get_clientsession(hass)
deconz = DeconzSession(hass.loop, websession, **deconz_config)

View File

@ -29,8 +29,9 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
sensors = hass.data[DECONZ_DATA].sensors
entities = []
for sensor in sensors.values():
if sensor.type in DECONZ_SENSOR:
for key in sorted(sensors.keys(), key=int):
sensor = sensors[key]
if sensor and sensor.type in DECONZ_SENSOR:
if sensor.type in DECONZ_REMOTE:
DeconzEvent(hass, sensor)
if sensor.battery:

View File

@ -681,7 +681,7 @@ pycsspeechtts==1.0.2
pydaikin==0.4
# homeassistant.components.deconz
pydeconz==24
pydeconz==25
# homeassistant.components.zwave
pydispatcher==2.0.5