From c294a534d0b6176cc35502f1f05f550a4187c1e6 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 23 Nov 2016 07:47:43 +0100 Subject: [PATCH] Migrate binary_sensor to async (#4516) --- homeassistant/components/binary_sensor/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index 18e33ffe738..38b08fd32b4 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -4,6 +4,7 @@ Component to interface with binary sensors. For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor/ """ +import asyncio import logging import voluptuous as vol @@ -39,13 +40,13 @@ SENSOR_CLASSES = [ SENSOR_CLASSES_SCHEMA = vol.All(vol.Lower, vol.In(SENSOR_CLASSES)) -def setup(hass, config): +@asyncio.coroutine +def async_setup(hass, config): """Track states and offer events for binary sensors.""" component = EntityComponent( logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) - component.setup(config) - + yield from component.async_setup(config) return True