Add discovery support to HEOS component (#22652)
* Add discovery entry point * Fix test * Correct test call method * Update netdisco to 2.6.0
This commit is contained in:
1 parent
471afb4702
commit
5651db4b5c
4 files changed
+35
-3
No files matched your search
@@ -20,7 +20,7 @@ from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.discovery import async_load_platform, async_discover
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
REQUIREMENTS = ['netdisco==2.5.0']
|
||||
REQUIREMENTS = ['netdisco==2.6.0']
|
||||
|
||||
DOMAIN = 'discovery'
|
||||
|
||||
@@ -35,6 +35,7 @@ SERVICE_FREEBOX = 'freebox'
|
||||
SERVICE_HASS_IOS_APP = 'hass_ios'
|
||||
SERVICE_HASSIO = 'hassio'
|
||||
SERVICE_HOMEKIT = 'homekit'
|
||||
SERVICE_HEOS = 'heos'
|
||||
SERVICE_HUE = 'philips_hue'
|
||||
SERVICE_IGD = 'igd'
|
||||
SERVICE_IKEA_TRADFRI = 'ikea_tradfri'
|
||||
@@ -57,6 +58,7 @@ CONFIG_ENTRY_HANDLERS = {
|
||||
SERVICE_DECONZ: 'deconz',
|
||||
'esphome': 'esphome',
|
||||
'google_cast': 'cast',
|
||||
SERVICE_HEOS: 'heos',
|
||||
SERVICE_HUE: 'hue',
|
||||
SERVICE_TELLDUSLIVE: 'tellduslive',
|
||||
SERVICE_IKEA_TRADFRI: 'tradfri',
|
||||
|
||||
@@ -21,6 +21,11 @@ class HeosFlowHandler(config_entries.ConfigFlow):
|
||||
VERSION = 1
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
|
||||
|
||||
async def async_step_discovery(self, discovery_info):
|
||||
"""Handle a discovered Heos device."""
|
||||
return await self.async_step_user(
|
||||
{CONF_HOST: discovery_info[CONF_HOST]})
|
||||
|
||||
async def async_step_import(self, user_input=None):
|
||||
"""Occurs when an entry is setup through config."""
|
||||
host = user_input[CONF_HOST]
|
||||
@@ -32,7 +37,7 @@ class HeosFlowHandler(config_entries.ConfigFlow):
|
||||
"""Obtain host and validate connection."""
|
||||
from pyheos import Heos
|
||||
|
||||
# Only a single entry is supported
|
||||
# Only a single entry is needed for all devices
|
||||
entries = self.hass.config_entries.async_entries(DOMAIN)
|
||||
if entries:
|
||||
return self.async_abort(reason='already_setup')
|
||||
|
||||
Reference in new issue
Block a user