Do not call update() in constructor (#8859)

This commit is contained in:
Fabian Affolter 2017-08-06 19:21:55 +02:00 committed by Paulus Schoutsen
parent ac9c1235bb
commit d8ca04a4bc
19 changed files with 43 additions and 57 deletions

View file

@ -37,7 +37,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
name = config.get(CONF_NAME)
ohmid = config.get(CONF_ID)
add_devices([OhmconnectSensor(name, ohmid)])
add_devices([OhmconnectSensor(name, ohmid)], True)
class OhmconnectSensor(Entity):
@ -48,7 +48,6 @@ class OhmconnectSensor(Entity):
self._name = name
self._ohmid = ohmid
self._data = {}
self.update()
@property
def name(self):
@ -80,4 +79,4 @@ class OhmconnectSensor(Entity):
self._data[child.tag] = child.text
except requests.exceptions.ConnectionError:
_LOGGER.error("No route to host/endpoint: %s", url)
self.data = {}
self._data = {}