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 2016-10-03 22:39:27 -07:00 committed by GitHub
parent f2a12b7ac2
commit d58548dd1c
10 changed files with 123 additions and 76 deletions

View file

@ -85,7 +85,7 @@ class BinarySensorTemplate(BinarySensorDevice):
@asyncio.coroutine
def template_bsensor_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_bsensor_state_listener)