Fix yamaha discovery (#64056)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/64060/head
epenet 2022-01-13 15:32:39 +01:00 committed by GitHub
parent c495317a71
commit c8043eccc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -108,10 +108,10 @@ class YamahaConfigInfo:
self.name = config.get(CONF_NAME)
self.host = config.get(CONF_HOST)
self.ctrl_url: str | None = f"http://{self.host}:80/YamahaRemoteControl/ctrl"
self.source_ignore = config[CONF_SOURCE_IGNORE]
self.source_names = config[CONF_SOURCE_NAMES]
self.zone_ignore = config[CONF_ZONE_IGNORE]
self.zone_names = config[CONF_ZONE_NAMES]
self.source_ignore = config.get(CONF_SOURCE_IGNORE)
self.source_names = config.get(CONF_SOURCE_NAMES)
self.zone_ignore = config.get(CONF_ZONE_IGNORE)
self.zone_names = config.get(CONF_ZONE_NAMES)
self.from_discovery = False
if discovery_info is not None:
self.name = discovery_info.get("name")
@ -161,7 +161,7 @@ async def async_setup_platform(
entities = []
for receiver in receivers:
if receiver.zone in config_info.zone_ignore:
if config_info.zone_ignore and receiver.zone in config_info.zone_ignore:
continue
entity = YamahaDevice(

View File

@ -74,12 +74,6 @@ async def test_setup_no_host(hass, device, main_zone):
async def test_setup_discovery(hass, device, main_zone):
"""Test set up integration via discovery."""
with patch("rxv.find", return_value=[device]):
assert await async_setup_component(
hass, "media_player", {"media_player": {"platform": "yamaha"}}
)
await hass.async_block_till_done()
discovery_info = {
"name": "Yamaha Receiver",
"model_name": "Yamaha",