From d43101f22a045b58b37cbdaedae19185d9614b53 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 18 Jan 2016 19:41:41 +0100 Subject: [PATCH] fix issue where sensors and switches were duplicated because of component getting initialized twice. closes #913 --- homeassistant/components/sensor/tellduslive.py | 3 ++- homeassistant/components/switch/tellduslive.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/tellduslive.py b/homeassistant/components/sensor/tellduslive.py index ae05ce47e19..364b790ce6f 100644 --- a/homeassistant/components/sensor/tellduslive.py +++ b/homeassistant/components/sensor/tellduslive.py @@ -18,7 +18,6 @@ from homeassistant.components import tellduslive ATTR_LAST_UPDATED = "time_last_updated" _LOGGER = logging.getLogger(__name__) -DEPENDENCIES = ['tellduslive'] SENSOR_TYPE_TEMP = "temp" SENSOR_TYPE_HUMIDITY = "humidity" @@ -43,6 +42,8 @@ SENSOR_TYPES = { def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up Tellstick sensors. """ + if discovery_info is None: + return sensors = tellduslive.NETWORK.get_sensors() devices = [] diff --git a/homeassistant/components/switch/tellduslive.py b/homeassistant/components/switch/tellduslive.py index d515dcb50a2..b6c7af3ce12 100644 --- a/homeassistant/components/switch/tellduslive.py +++ b/homeassistant/components/switch/tellduslive.py @@ -15,11 +15,12 @@ from homeassistant.components import tellduslive from homeassistant.helpers.entity import ToggleEntity _LOGGER = logging.getLogger(__name__) -DEPENDENCIES = ['tellduslive'] def setup_platform(hass, config, add_devices, discovery_info=None): """ Find and return Tellstick switches. """ + if discovery_info is None: + return switches = tellduslive.NETWORK.get_switches() add_devices([TelldusLiveSwitch(switch["name"], switch["id"])