From 8a042586f1f446ccf4e4779e49783cf94eba3fb7 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 2 Dec 2016 03:31:55 +0100 Subject: [PATCH] Migrate sensor to async (#4663) --- homeassistant/components/sensor/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index c018c04cdaf..b4a467e240f 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -4,6 +4,7 @@ Component to interface with various sensors that can be monitored. For more details about this component, please refer to the documentation at https://home-assistant.io/components/sensor/ """ +import asyncio import logging from homeassistant.helpers.entity_component import EntityComponent @@ -15,11 +16,11 @@ SCAN_INTERVAL = 30 ENTITY_ID_FORMAT = DOMAIN + '.{}' -def setup(hass, config): +@asyncio.coroutine +def async_setup(hass, config): """Track states and offer events for sensors.""" component = EntityComponent( logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) - component.setup(config) - + yield from component.async_setup(config) return True