discover binary sensor

This commit is contained in:
Tobias Haase
2019-08-01 23:51:46 +02:00
parent bd7f423c21
commit 1aff744e50

View File

@@ -15,6 +15,7 @@ import voluptuous as vol
from homeassistant.const import __version__ as current_version from homeassistant.const import __version__ as current_version
from homeassistant.helpers import event from homeassistant.helpers import event
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers import discovery
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@@ -53,7 +54,7 @@ class Updater:
"""Updater class for data exchange.""" """Updater class for data exchange."""
def __init__(self, update_available: bool, newest_version: str, release_notes: str): def __init__(self, update_available: bool, newest_version: str, release_notes: str):
"""Setup Updater.""" """Setup Updater and initialise attributes."""
self.update_available = update_available self.update_available = update_available
self.release_notes = release_notes self.release_notes = release_notes
self.newest_version = newest_version self.newest_version = newest_version
@@ -93,6 +94,10 @@ async def async_setup(hass, config):
include_components = config.get(CONF_COMPONENT_REPORTING) include_components = config.get(CONF_COMPONENT_REPORTING)
hass.async_create_task(
discovery.async_load_platform(hass, "binary_sensor", DOMAIN, {}, config)
)
async def check_new_version(now): async def check_new_version(now):
"""Check if a new version is available and report if one is.""" """Check if a new version is available and report if one is."""
result = await get_newest_version(hass, huuid, include_components) result = await get_newest_version(hass, huuid, include_components)