mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Migrate HEOS discovery to manifest (#24508)
* Migrate HEOS discovery to manifest * Fix tests
This commit is contained in:
parent
4c328e4959
commit
f54ad26630
@ -47,7 +47,6 @@ SERVICE_XIAOMI_GW = 'xiaomi_gw'
|
|||||||
|
|
||||||
CONFIG_ENTRY_HANDLERS = {
|
CONFIG_ENTRY_HANDLERS = {
|
||||||
SERVICE_DAIKIN: 'daikin',
|
SERVICE_DAIKIN: 'daikin',
|
||||||
SERVICE_HEOS: 'heos',
|
|
||||||
SERVICE_TELLDUSLIVE: 'tellduslive',
|
SERVICE_TELLDUSLIVE: 'tellduslive',
|
||||||
'sonos': 'sonos',
|
'sonos': 'sonos',
|
||||||
SERVICE_IGD: 'upnp',
|
SERVICE_IGD: 'upnp',
|
||||||
@ -97,6 +96,7 @@ MIGRATED_SERVICE_HANDLERS = [
|
|||||||
'deconz',
|
'deconz',
|
||||||
'esphome',
|
'esphome',
|
||||||
'google_cast',
|
'google_cast',
|
||||||
|
SERVICE_HEOS,
|
||||||
'homekit',
|
'homekit',
|
||||||
'ikea_tradfri',
|
'ikea_tradfri',
|
||||||
'philips_hue',
|
'philips_hue',
|
||||||
|
@ -22,7 +22,7 @@ class HeosFlowHandler(config_entries.ConfigFlow):
|
|||||||
VERSION = 1
|
VERSION = 1
|
||||||
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
|
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
|
||||||
|
|
||||||
async def async_step_discovery(self, discovery_info):
|
async def async_step_ssdp(self, discovery_info):
|
||||||
"""Handle a discovered Heos device."""
|
"""Handle a discovered Heos device."""
|
||||||
# Store discovered host
|
# Store discovered host
|
||||||
friendly_name = "{} ({})".format(
|
friendly_name = "{} ({})".format(
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
"requirements": [
|
"requirements": [
|
||||||
"pyheos==0.5.2"
|
"pyheos==0.5.2"
|
||||||
],
|
],
|
||||||
|
"ssdp": {
|
||||||
|
"st": [
|
||||||
|
"urn:schemas-denon-com:device:ACT-Denon:1"
|
||||||
|
]
|
||||||
|
},
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
"@andrewsayre"
|
"@andrewsayre"
|
||||||
|
@ -15,5 +15,9 @@ SSDP = {
|
|||||||
"hue"
|
"hue"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"st": {}
|
"st": {
|
||||||
|
"urn:schemas-denon-com:device:ACT-Denon:1": [
|
||||||
|
"heos"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ async def test_create_entry_when_friendly_name_valid(hass, controller):
|
|||||||
async def test_discovery_shows_create_form(hass, controller, discovery_data):
|
async def test_discovery_shows_create_form(hass, controller, discovery_data):
|
||||||
"""Test discovery shows form to confirm setup and subsequent abort."""
|
"""Test discovery shows form to confirm setup and subsequent abort."""
|
||||||
await hass.config_entries.flow.async_init(
|
await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={'source': 'discovery'},
|
DOMAIN, context={'source': 'ssdp'},
|
||||||
data=discovery_data)
|
data=discovery_data)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(hass.config_entries.flow.async_progress()) == 1
|
assert len(hass.config_entries.flow.async_progress()) == 1
|
||||||
@ -87,7 +87,7 @@ async def test_discovery_shows_create_form(hass, controller, discovery_data):
|
|||||||
discovery_data[CONF_HOST] = "127.0.0.2"
|
discovery_data[CONF_HOST] = "127.0.0.2"
|
||||||
discovery_data[CONF_NAME] = "Bedroom"
|
discovery_data[CONF_NAME] = "Bedroom"
|
||||||
await hass.config_entries.flow.async_init(
|
await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={'source': 'discovery'},
|
DOMAIN, context={'source': 'ssdp'},
|
||||||
data=discovery_data)
|
data=discovery_data)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(hass.config_entries.flow.async_progress()) == 1
|
assert len(hass.config_entries.flow.async_progress()) == 1
|
||||||
@ -103,6 +103,6 @@ async def test_disovery_flow_aborts_already_setup(
|
|||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
flow = HeosFlowHandler()
|
flow = HeosFlowHandler()
|
||||||
flow.hass = hass
|
flow.hass = hass
|
||||||
result = await flow.async_step_discovery(discovery_data)
|
result = await flow.async_step_ssdp(discovery_data)
|
||||||
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result['reason'] == 'already_setup'
|
assert result['reason'] == 'already_setup'
|
||||||
|
@ -27,7 +27,8 @@ async def test_async_setup_creates_entry(hass, config):
|
|||||||
assert entry.data == {CONF_HOST: '127.0.0.1'}
|
assert entry.data == {CONF_HOST: '127.0.0.1'}
|
||||||
|
|
||||||
|
|
||||||
async def test_async_setup_updates_entry(hass, config_entry, config):
|
async def test_async_setup_updates_entry(hass, config_entry, config,
|
||||||
|
controller):
|
||||||
"""Test component setup updates entry from config."""
|
"""Test component setup updates entry from config."""
|
||||||
config[DOMAIN][CONF_HOST] = '127.0.0.2'
|
config[DOMAIN][CONF_HOST] = '127.0.0.2'
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user