Migrate sensor to async (#4663)

This commit is contained in:
Pascal Vizeli 2016-12-02 03:31:55 +01:00 committed by Paulus Schoutsen
parent 08f8e540e3
commit 8a042586f1

View File

@ -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 For more details about this component, please refer to the documentation at
https://home-assistant.io/components/sensor/ https://home-assistant.io/components/sensor/
""" """
import asyncio
import logging import logging
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
@ -15,11 +16,11 @@ SCAN_INTERVAL = 30
ENTITY_ID_FORMAT = DOMAIN + '.{}' ENTITY_ID_FORMAT = DOMAIN + '.{}'
def setup(hass, config): @asyncio.coroutine
def async_setup(hass, config):
"""Track states and offer events for sensors.""" """Track states and offer events for sensors."""
component = EntityComponent( component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL)
component.setup(config) yield from component.async_setup(config)
return True return True