deConz rewrite to use async await syntax (#13151)

* Rewrite to use async await syntax

* Fix hound comment
This commit is contained in:
Kane610 2018-03-13 08:47:45 +01:00 committed by Martin Hjelmare
parent 53351423dd
commit 8a1687accb
6 changed files with 37 additions and 61 deletions

View file

@ -4,8 +4,6 @@ Support for deCONZ binary sensor.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.deconz/
"""
import asyncio
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.deconz import (
DOMAIN as DATA_DECONZ, DATA_DECONZ_ID)
@ -15,8 +13,8 @@ from homeassistant.core import callback
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 the deCONZ binary sensor."""
if discovery_info is None:
return
@ -39,8 +37,7 @@ class DeconzBinarySensor(BinarySensorDevice):
"""Set up sensor and add update callback to get data from websocket."""
self._sensor = sensor
@asyncio.coroutine
def async_added_to_hass(self):
async def async_added_to_hass(self):
"""Subscribe sensors events."""
self._sensor.register_async_callback(self.async_update_callback)
self.hass.data[DATA_DECONZ_ID][self.entity_id] = self._sensor.deconz_id