deConz rewrite to use async await syntax (#13151)
* Rewrite to use async await syntax * Fix hound comment
This commit is contained in:
parent
53351423dd
commit
8a1687accb
6 changed files with 37 additions and 61 deletions
|
@ -4,8 +4,6 @@ Support for deCONZ scenes.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/scene.deconz/
|
||||
"""
|
||||
import asyncio
|
||||
|
||||
from homeassistant.components.deconz import (
|
||||
DOMAIN as DATA_DECONZ, DATA_DECONZ_ID)
|
||||
from homeassistant.components.scene import Scene
|
||||
|
@ -13,8 +11,8 @@ from homeassistant.components.scene import Scene
|
|||
DEPENDENCIES = ['deconz']
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
async def async_setup_platform(hass, config, async_add_devices,
|
||||
discovery_info=None):
|
||||
"""Set up scenes for deCONZ component."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
@ -34,15 +32,13 @@ class DeconzScene(Scene):
|
|||
"""Set up a scene."""
|
||||
self._scene = scene
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self):
|
||||
"""Subscribe to sensors events."""
|
||||
self.hass.data[DATA_DECONZ_ID][self.entity_id] = self._scene.deconz_id
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_activate(self):
|
||||
async def async_activate(self):
|
||||
"""Activate the scene."""
|
||||
yield from self._scene.async_set_state({})
|
||||
await self._scene.async_set_state({})
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue