Address asyncio comments (#3663)

* Template platforms: create_task instead of yield from

* Automation: less yielding, more create_tasking

* Helpers.script: less yielding, more create_tasking

* Deflake logbook test

* Deflake automation reload config test

* MQTT: Use async_add_job and threaded_listener_factory

* Deflake other logbook test

* lint

* Add test for automation trigger service

* MQTT client can be called from within async
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-10-03 22:39:27 -07:00
1 parent f2a12b7ac2
commit d58548dd1c
10 files changed
+123 -76

No files matched your search

+1 -1
View File
@@ -82,7 +82,7 @@ class SensorTemplate(Entity):
@asyncio.coroutine
def template_sensor_state_listener(entity, old_state, new_state):
"""Called when the target device changes state."""
yield from self.async_update_ha_state(True)
hass.loop.create_task(self.async_update_ha_state(True))
track_state_change(hass, entity_ids, template_sensor_state_listener)