async_create_task (#17059)

* async_create_task

* Update google.py
This commit is contained in:
cdce8p authored and Paulus Schoutsen committed 2018-10-02 11:03:09 +02:00
1 parent 37706c2731
commit 7f0a50ce31
41 files changed
+76 -72

No files matched your search

+1 -1
View File
@@ -167,7 +167,7 @@ async def async_setup_platform(hass, config, async_add_entities,
# Make all device entities aware of new telegram
for device in devices:
device.telegram = telegram
hass.async_add_job(device.async_update_ha_state())
hass.async_create_task(device.async_update_ha_state())
# Creates an asyncio.Protocol factory for reading DSMR telegrams from
# serial and calls update_entities_telegram to update entities on arrival
+2 -2
View File
@@ -93,7 +93,7 @@ class TradfriDevice(Entity):
cmd = self._device.observe(callback=self._observe_update,
err_callback=self._async_start_observe,
duration=0)
self.hass.async_add_job(self._api(cmd))
self.hass.async_create_task(self._api(cmd))
except PytradfriError as err:
_LOGGER.warning("Observation failed, trying again", exc_info=err)
self._async_start_observe()
@@ -107,4 +107,4 @@ class TradfriDevice(Entity):
"""Receive new state data for this device."""
self._refresh(tradfri_device)
self.hass.async_add_job(self.async_update_ha_state())
self.hass.async_create_task(self.async_update_ha_state())