Fix Dark Sky async I/O (#4299)
This commit is contained in:
parent
67b599475e
commit
9561fed650
1 changed files with 2 additions and 5 deletions
|
@ -113,6 +113,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
longitude=hass.config.longitude,
|
||||
units=units,
|
||||
interval=config.get(CONF_UPDATE_INTERVAL))
|
||||
forecast_data.update()
|
||||
forecast_data.update_currently()
|
||||
except ValueError as error:
|
||||
_LOGGER.error(error)
|
||||
|
@ -124,7 +125,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
for variable in config[CONF_MONITORED_CONDITIONS]:
|
||||
sensors.append(DarkSkySensor(forecast_data, variable, name))
|
||||
|
||||
add_devices(sensors)
|
||||
add_devices(sensors, True)
|
||||
|
||||
|
||||
class DarkSkySensor(Entity):
|
||||
|
@ -139,8 +140,6 @@ class DarkSkySensor(Entity):
|
|||
self._state = None
|
||||
self._unit_of_measurement = None
|
||||
|
||||
self.update()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
|
@ -277,8 +276,6 @@ class DarkSkyData(object):
|
|||
self.update_hourly = Throttle(interval)(self._update_hourly)
|
||||
self.update_daily = Throttle(interval)(self._update_daily)
|
||||
|
||||
self.update()
|
||||
|
||||
def _update(self):
|
||||
"""Get the latest data from Dark Sky."""
|
||||
import forecastio
|
||||
|
|
Loading…
Add table
Reference in a new issue