mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 05:35:11 +02:00
discover binary sensor
This commit is contained in:
@@ -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)
|
||||||
@@ -156,7 +161,7 @@ async def get_newest_version(hass, huuid, include_components):
|
|||||||
req = await session.post(UPDATER_URL, json=info_object)
|
req = await session.post(UPDATER_URL, json=info_object)
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
(
|
(
|
||||||
"Submitted analytics to Home Assistant servers."
|
"Submitted analytics to Home Assistant servers. "
|
||||||
"Information submitted includes %s"
|
"Information submitted includes %s"
|
||||||
),
|
),
|
||||||
info_object,
|
info_object,
|
||||||
|
Reference in New Issue
Block a user