Async syntax 7, switch & tts & vacuum (#17021)

This commit is contained in:
cdce8p 2018-10-01 08:55:00 +02:00 committed by Paulus Schoutsen
parent 9aaf11de8c
commit 121dba659c
20 changed files with 163 additions and 253 deletions

View file

@ -4,7 +4,6 @@ Support for switching devices via Pilight to on and off.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.pilight/
"""
import asyncio
import logging
import voluptuous as vol
@ -122,10 +121,9 @@ class PilightSwitch(SwitchDevice):
if any(self._code_on_receive) or any(self._code_off_receive):
hass.bus.listen(pilight.EVENT, self._handle_code)
@asyncio.coroutine
def async_added_to_hass(self):
async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
state = yield from async_get_last_state(self._hass, self.entity_id)
state = await async_get_last_state(self._hass, self.entity_id)
if state:
self._state = state.state == STATE_ON