Fix adding devices on the fly

Devices were not added without persistence enabled and restart of HA.
Node id was added to defaultdict(list) by mistake when checking if list
of defaultdict was empty.

* Fix adding devices in mysensors_callback.
* Change devices to regular dict.
This commit is contained in:
MartinHjelmare committed 2016-01-26 18:12:13 +01:00
1 parent 6c91831baa
commit 9117fa6eb8
3 files changed
+14 -20

No files matched your search

+1 -2
View File
@@ -7,7 +7,6 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mysensors/
"""
import logging
from collections import defaultdict
from homeassistant.helpers.entity import Entity
@@ -72,7 +71,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
v_types = [member for member in gateway.const.SetReq
if member.value not in not_v_types]
devices = defaultdict(list)
devices = {}
gateway.platform_callbacks.append(mysensors.pf_callback_factory(
s_types, v_types, devices, add_devices, MySensorsSensor))