diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py index 33057c501fd..196e16298ef 100644 --- a/homeassistant/components/zeroconf/__init__.py +++ b/homeassistant/components/zeroconf/__init__.py @@ -383,8 +383,8 @@ class ZeroconfDiscovery: async_dispatcher_connect( self.hass, - config_entries.SIGNAL_CONFIG_ENTRY_CHANGED, - self._handle_config_entry_changed, + config_entries.signal_discovered_config_entry_removed(DOMAIN), + self._handle_config_entry_removed, ) async def async_stop(self) -> None: @@ -393,20 +393,16 @@ class ZeroconfDiscovery: await self.async_service_browser.async_cancel() @callback - def _handle_config_entry_changed( + def _handle_config_entry_removed( self, change: config_entries.ConfigEntryChange, entry: config_entries.ConfigEntry, ) -> None: """Handle config entry changes.""" - if ( - change != config_entries.ConfigEntryChange.REMOVED - or entry.source != config_entries.SOURCE_IGNORE - or not (discovery_keys := entry.discovery_keys) - ): + if entry.source != config_entries.SOURCE_IGNORE: return - for discovery_key in discovery_keys: - if discovery_key.domain != DOMAIN or discovery_key.version != 1: + for discovery_key in entry.discovery_keys[DOMAIN]: + if discovery_key.version != 1: continue _type = discovery_key.key[0] name = discovery_key.key[1] diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 489afb723b7..099b8ca2807 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -18,7 +18,7 @@ from copy import deepcopy from datetime import datetime from enum import Enum, StrEnum import functools -from functools import cached_property +from functools import cache, cached_property import logging from random import randint from types import MappingProxyType @@ -192,6 +192,15 @@ SIGNAL_CONFIG_ENTRY_CHANGED = SignalType["ConfigEntryChange", "ConfigEntry"]( "config_entry_changed" ) + +@cache +def signal_discovered_config_entry_removed( + discovery_domain: str, +) -> SignalType[ConfigEntryChange, ConfigEntry]: + """Format signal.""" + return SignalType(f"{discovery_domain}_discovered_config_entry_removed") + + NO_RESET_TRIES_STATES = { ConfigEntryState.SETUP_RETRY, ConfigEntryState.SETUP_IN_PROGRESS, @@ -318,7 +327,7 @@ class ConfigEntry(Generic[_DataT]): _tries: int created_at: datetime modified_at: datetime - discovery_keys: tuple[DiscoveryKey, ...] + discovery_keys: MappingProxyType[str, tuple[DiscoveryKey, ...]] def __init__( self, @@ -326,7 +335,7 @@ class ConfigEntry(Generic[_DataT]): created_at: datetime | None = None, data: Mapping[str, Any], disabled_by: ConfigEntryDisabler | None = None, - discovery_keys: tuple[DiscoveryKey, ...], + discovery_keys: MappingProxyType[str, tuple[DiscoveryKey, ...]], domain: str, entry_id: str | None = None, minor_version: int, @@ -955,7 +964,7 @@ class ConfigEntry(Generic[_DataT]): return { "created_at": self.created_at.isoformat(), "data": dict(self.data), - "discovery_keys": self.discovery_keys, + "discovery_keys": dict(self.discovery_keys), "disabled_by": self.disabled_by, "domain": self.domain, "entry_id": self.entry_id, @@ -1380,14 +1389,26 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]): ) ) and entry.source == SOURCE_IGNORE - and discovery_key not in (known_discovery_keys := entry.discovery_keys) + and discovery_key + not in ( + known_discovery_keys := entry.discovery_keys.get( + discovery_key.domain, () + ) + ) ): - new_discovery_keys = tuple([*known_discovery_keys, discovery_key][-10:]) + new_discovery_keys = MappingProxyType( + entry.discovery_keys + | { + discovery_key.domain: tuple( + [*known_discovery_keys, discovery_key][-10:] + ) + } + ) _LOGGER.debug( "Updating discovery keys for %s entry %s %s -> %s", entry.domain, unique_id, - known_discovery_keys, + entry.discovery_keys, new_discovery_keys, ) self.config_entries.async_update_entry( @@ -1450,7 +1471,11 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]): await self.config_entries.async_unload(existing_entry.entry_id) discovery_key = flow.context.get("discovery_key") - discovery_keys = (discovery_key,) if discovery_key else () + discovery_keys = ( + MappingProxyType({discovery_key.domain: (discovery_key,)}) + if discovery_key + else MappingProxyType({}) + ) entry = ConfigEntry( data=result["data"], discovery_keys=discovery_keys, @@ -1684,7 +1709,7 @@ class ConfigEntryStore(storage.Store[dict[str, list[dict[str, Any]]]]): if old_minor_version < 4: # Version 1.4 adds discovery_keys for entry in data["entries"]: - entry["discovery_keys"] = [] + entry["discovery_keys"] = {} if old_major_version > 1: raise NotImplementedError @@ -1846,6 +1871,13 @@ class ConfigEntries: ) self._async_dispatch(ConfigEntryChange.REMOVED, entry) + for discovery_domain in entry.discovery_keys: + async_dispatcher_send_internal( + self.hass, + signal_discovered_config_entry_removed(discovery_domain), + ConfigEntryChange.REMOVED, + entry, + ) return {"require_restart": not unload_success} @callback @@ -1873,8 +1905,11 @@ class ConfigEntries: created_at=datetime.fromisoformat(entry["created_at"]), data=entry["data"], disabled_by=try_parse_enum(ConfigEntryDisabler, entry["disabled_by"]), - discovery_keys=tuple( - DiscoveryKey.from_json_dict(key) for key in entry["discovery_keys"] + discovery_keys=MappingProxyType( + { + domain: tuple(DiscoveryKey.from_json_dict(key) for key in keys) + for domain, keys in entry["discovery_keys"].items() + } ), domain=entry["domain"], entry_id=entry_id, @@ -2032,7 +2067,8 @@ class ConfigEntries: entry: ConfigEntry, *, data: Mapping[str, Any] | UndefinedType = UNDEFINED, - discovery_keys: tuple[DiscoveryKey, ...] | UndefinedType = UNDEFINED, + discovery_keys: MappingProxyType[str, tuple[DiscoveryKey, ...]] + | UndefinedType = UNDEFINED, minor_version: int | UndefinedType = UNDEFINED, options: Mapping[str, Any] | UndefinedType = UNDEFINED, pref_disable_new_entities: bool | UndefinedType = UNDEFINED, diff --git a/tests/common.py b/tests/common.py index b0d471efe95..9603e7e2f29 100644 --- a/tests/common.py +++ b/tests/common.py @@ -990,7 +990,7 @@ class MockConfigEntry(config_entries.ConfigEntry): *, data=None, disabled_by=None, - discovery_keys=(), + discovery_keys=None, domain="test", entry_id=None, minor_version=1, @@ -1005,6 +1005,7 @@ class MockConfigEntry(config_entries.ConfigEntry): version=1, ) -> None: """Initialize a mock config entry.""" + discovery_keys = discovery_keys or {} kwargs = { "data": data or {}, "disabled_by": disabled_by, diff --git a/tests/components/aemet/snapshots/test_diagnostics.ambr b/tests/components/aemet/snapshots/test_diagnostics.ambr index 5200be7a54a..54546507dfa 100644 --- a/tests/components/aemet/snapshots/test_diagnostics.ambr +++ b/tests/components/aemet/snapshots/test_diagnostics.ambr @@ -11,8 +11,8 @@ 'name': 'AEMET', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'aemet', 'entry_id': '7442b231f139e813fc1939281123f220', 'minor_version': 1, diff --git a/tests/components/airly/snapshots/test_diagnostics.ambr b/tests/components/airly/snapshots/test_diagnostics.ambr index 33f038cf6d4..ec501b2fd7e 100644 --- a/tests/components/airly/snapshots/test_diagnostics.ambr +++ b/tests/components/airly/snapshots/test_diagnostics.ambr @@ -9,8 +9,8 @@ 'name': 'Home', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airly', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/airnow/snapshots/test_diagnostics.ambr b/tests/components/airnow/snapshots/test_diagnostics.ambr index 4d9d94288de..3dd4788dc61 100644 --- a/tests/components/airnow/snapshots/test_diagnostics.ambr +++ b/tests/components/airnow/snapshots/test_diagnostics.ambr @@ -24,8 +24,8 @@ 'longitude': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airnow', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/airvisual/snapshots/test_diagnostics.ambr b/tests/components/airvisual/snapshots/test_diagnostics.ambr index bbc75b6b1c0..606d6082351 100644 --- a/tests/components/airvisual/snapshots/test_diagnostics.ambr +++ b/tests/components/airvisual/snapshots/test_diagnostics.ambr @@ -36,8 +36,8 @@ 'longitude': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airvisual', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/airvisual_pro/snapshots/test_diagnostics.ambr b/tests/components/airvisual_pro/snapshots/test_diagnostics.ambr index a54b61812eb..cb1d3a7aee7 100644 --- a/tests/components/airvisual_pro/snapshots/test_diagnostics.ambr +++ b/tests/components/airvisual_pro/snapshots/test_diagnostics.ambr @@ -91,8 +91,8 @@ 'password': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airvisual_pro', 'entry_id': '6a2b3770e53c28dc1eeb2515e906b0ce', 'minor_version': 1, diff --git a/tests/components/airzone/snapshots/test_diagnostics.ambr b/tests/components/airzone/snapshots/test_diagnostics.ambr index 6fc57f0483e..693550a3e1c 100644 --- a/tests/components/airzone/snapshots/test_diagnostics.ambr +++ b/tests/components/airzone/snapshots/test_diagnostics.ambr @@ -238,8 +238,8 @@ 'port': 3000, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airzone', 'entry_id': '6e7a0798c1734ba81d26ced0e690eaec', 'minor_version': 1, diff --git a/tests/components/airzone_cloud/snapshots/test_diagnostics.ambr b/tests/components/airzone_cloud/snapshots/test_diagnostics.ambr index 9f9285526e8..86b5c75b290 100644 --- a/tests/components/airzone_cloud/snapshots/test_diagnostics.ambr +++ b/tests/components/airzone_cloud/snapshots/test_diagnostics.ambr @@ -91,8 +91,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'airzone_cloud', 'entry_id': 'd186e31edb46d64d14b9b2f11f1ebd9f', 'minor_version': 1, diff --git a/tests/components/ambient_station/snapshots/test_diagnostics.ambr b/tests/components/ambient_station/snapshots/test_diagnostics.ambr index ab6c485aabf..2f90b09d39f 100644 --- a/tests/components/ambient_station/snapshots/test_diagnostics.ambr +++ b/tests/components/ambient_station/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'app_key': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'ambient_station', 'entry_id': '382cf7643f016fd48b3fe52163fe8877', 'minor_version': 1, diff --git a/tests/components/androidtv/test_diagnostics.py b/tests/components/androidtv/test_diagnostics.py index 2584f4b528c..40dba53bd9b 100644 --- a/tests/components/androidtv/test_diagnostics.py +++ b/tests/components/androidtv/test_diagnostics.py @@ -36,4 +36,4 @@ async def test_diagnostics( hass, hass_client, mock_config_entry ) - assert result["entry"] == entry_dict | {"discovery_keys": []} + assert result["entry"] == entry_dict | {"discovery_keys": {}} diff --git a/tests/components/asuswrt/test_diagnostics.py b/tests/components/asuswrt/test_diagnostics.py index 09df309953d..1acaf686567 100644 --- a/tests/components/asuswrt/test_diagnostics.py +++ b/tests/components/asuswrt/test_diagnostics.py @@ -38,4 +38,4 @@ async def test_diagnostics( hass, hass_client, mock_config_entry ) - assert result["entry"] == entry_dict | {"discovery_keys": []} + assert result["entry"] == entry_dict | {"discovery_keys": {}} diff --git a/tests/components/axis/snapshots/test_diagnostics.ambr b/tests/components/axis/snapshots/test_diagnostics.ambr index 513357a76a3..ebd0061f416 100644 --- a/tests/components/axis/snapshots/test_diagnostics.ambr +++ b/tests/components/axis/snapshots/test_diagnostics.ambr @@ -37,8 +37,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'axis', 'entry_id': '676abe5b73621446e6550a2e86ffe3dd', 'minor_version': 1, diff --git a/tests/components/blink/snapshots/test_diagnostics.ambr b/tests/components/blink/snapshots/test_diagnostics.ambr index 8d3c63b3d0a..edc2879a66b 100644 --- a/tests/components/blink/snapshots/test_diagnostics.ambr +++ b/tests/components/blink/snapshots/test_diagnostics.ambr @@ -38,8 +38,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'blink', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/braviatv/snapshots/test_diagnostics.ambr b/tests/components/braviatv/snapshots/test_diagnostics.ambr index 3ffaba03426..cd29c647df7 100644 --- a/tests/components/braviatv/snapshots/test_diagnostics.ambr +++ b/tests/components/braviatv/snapshots/test_diagnostics.ambr @@ -9,8 +9,8 @@ 'use_psk': True, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'braviatv', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/co2signal/snapshots/test_diagnostics.ambr b/tests/components/co2signal/snapshots/test_diagnostics.ambr index db61938ad90..9218e7343ec 100644 --- a/tests/components/co2signal/snapshots/test_diagnostics.ambr +++ b/tests/components/co2signal/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'location': '', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'co2signal', 'entry_id': '904a74160aa6f335526706bee85dfb83', 'minor_version': 1, diff --git a/tests/components/coinbase/snapshots/test_diagnostics.ambr b/tests/components/coinbase/snapshots/test_diagnostics.ambr index 665bb4b47fb..51bd946f140 100644 --- a/tests/components/coinbase/snapshots/test_diagnostics.ambr +++ b/tests/components/coinbase/snapshots/test_diagnostics.ambr @@ -30,8 +30,8 @@ 'api_token': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'coinbase', 'entry_id': '080272b77a4f80c41b94d7cdc86fd826', 'minor_version': 1, diff --git a/tests/components/config/test_config_entries.py b/tests/components/config/test_config_entries.py index 879e2dac9ff..34697c2c2f1 100644 --- a/tests/components/config/test_config_entries.py +++ b/tests/components/config/test_config_entries.py @@ -1326,11 +1326,11 @@ async def test_disable_entry_nonexisting( [ ( {}, - (), + {}, ), ( {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, - (DiscoveryKey(domain="test", key="blah", version=1),), + {"test": (DiscoveryKey(domain="test", key="blah", version=1),)}, ), ], ) diff --git a/tests/components/deconz/snapshots/test_diagnostics.ambr b/tests/components/deconz/snapshots/test_diagnostics.ambr index fd543e6108c..1ca674a4fbe 100644 --- a/tests/components/deconz/snapshots/test_diagnostics.ambr +++ b/tests/components/deconz/snapshots/test_diagnostics.ambr @@ -10,8 +10,8 @@ 'port': 80, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'deconz', 'entry_id': '1', 'minor_version': 1, diff --git a/tests/components/devolo_home_control/snapshots/test_diagnostics.ambr b/tests/components/devolo_home_control/snapshots/test_diagnostics.ambr index fbc39882442..6a7ef1fc6d3 100644 --- a/tests/components/devolo_home_control/snapshots/test_diagnostics.ambr +++ b/tests/components/devolo_home_control/snapshots/test_diagnostics.ambr @@ -38,8 +38,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'devolo_home_control', 'entry_id': '123456', 'minor_version': 1, diff --git a/tests/components/devolo_home_network/snapshots/test_diagnostics.ambr b/tests/components/devolo_home_network/snapshots/test_diagnostics.ambr index 86b6e441911..3da8c76c2b4 100644 --- a/tests/components/devolo_home_network/snapshots/test_diagnostics.ambr +++ b/tests/components/devolo_home_network/snapshots/test_diagnostics.ambr @@ -22,8 +22,8 @@ 'password': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'devolo_home_network', 'entry_id': '123456', 'minor_version': 1, diff --git a/tests/components/dsmr_reader/snapshots/test_diagnostics.ambr b/tests/components/dsmr_reader/snapshots/test_diagnostics.ambr index 2091ebbf1f3..d407fe2dc5b 100644 --- a/tests/components/dsmr_reader/snapshots/test_diagnostics.ambr +++ b/tests/components/dsmr_reader/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'dsmr_reader', 'entry_id': 'TEST_ENTRY_ID', 'minor_version': 1, diff --git a/tests/components/ecovacs/snapshots/test_diagnostics.ambr b/tests/components/ecovacs/snapshots/test_diagnostics.ambr index 70f5d669b44..38c8a9a5ab9 100644 --- a/tests/components/ecovacs/snapshots/test_diagnostics.ambr +++ b/tests/components/ecovacs/snapshots/test_diagnostics.ambr @@ -8,8 +8,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'ecovacs', 'minor_version': 1, 'options': dict({ @@ -61,8 +61,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'ecovacs', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/elgato/snapshots/test_config_flow.ambr b/tests/components/elgato/snapshots/test_config_flow.ambr index e25e243db07..d5d005cff9c 100644 --- a/tests/components/elgato/snapshots/test_config_flow.ambr +++ b/tests/components/elgato/snapshots/test_config_flow.ambr @@ -24,8 +24,8 @@ 'port': 9123, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'elgato', 'entry_id': , 'minor_version': 1, @@ -69,8 +69,8 @@ 'port': 9123, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'elgato', 'entry_id': , 'minor_version': 1, @@ -113,8 +113,8 @@ 'port': 9123, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'elgato', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/energyzero/snapshots/test_config_flow.ambr b/tests/components/energyzero/snapshots/test_config_flow.ambr index c96d21df54a..72e504c97c8 100644 --- a/tests/components/energyzero/snapshots/test_config_flow.ambr +++ b/tests/components/energyzero/snapshots/test_config_flow.ambr @@ -18,8 +18,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'energyzero', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/enphase_envoy/snapshots/test_diagnostics.ambr b/tests/components/enphase_envoy/snapshots/test_diagnostics.ambr index 7c1c6a5dfcc..76835098f27 100644 --- a/tests/components/enphase_envoy/snapshots/test_diagnostics.ambr +++ b/tests/components/enphase_envoy/snapshots/test_diagnostics.ambr @@ -10,8 +10,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'enphase_envoy', 'entry_id': '45a36e55aaddb2007c5f6602e0c38e72', 'minor_version': 1, @@ -443,8 +443,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'enphase_envoy', 'entry_id': '45a36e55aaddb2007c5f6602e0c38e72', 'minor_version': 1, @@ -917,8 +917,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'enphase_envoy', 'entry_id': '45a36e55aaddb2007c5f6602e0c38e72', 'minor_version': 1, diff --git a/tests/components/esphome/snapshots/test_diagnostics.ambr b/tests/components/esphome/snapshots/test_diagnostics.ambr index 3599f207806..4f7ea679b20 100644 --- a/tests/components/esphome/snapshots/test_diagnostics.ambr +++ b/tests/components/esphome/snapshots/test_diagnostics.ambr @@ -10,8 +10,8 @@ 'port': 6053, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'esphome', 'entry_id': '08d821dc059cf4f645cb024d32c8e708', 'minor_version': 1, diff --git a/tests/components/esphome/test_diagnostics.py b/tests/components/esphome/test_diagnostics.py index 031bb5e0080..832e7d6572f 100644 --- a/tests/components/esphome/test_diagnostics.py +++ b/tests/components/esphome/test_diagnostics.py @@ -70,7 +70,7 @@ async def test_diagnostics_with_bluetooth( "port": 6053, }, "disabled_by": None, - "discovery_keys": [], + "discovery_keys": {}, "domain": "esphome", "entry_id": ANY, "minor_version": 1, diff --git a/tests/components/forecast_solar/snapshots/test_init.ambr b/tests/components/forecast_solar/snapshots/test_init.ambr index e3eff26f2cd..6ae4c2f6198 100644 --- a/tests/components/forecast_solar/snapshots/test_init.ambr +++ b/tests/components/forecast_solar/snapshots/test_init.ambr @@ -6,8 +6,8 @@ 'longitude': 4.42, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'forecast_solar', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/fritz/snapshots/test_diagnostics.ambr b/tests/components/fritz/snapshots/test_diagnostics.ambr index 744f8c0fd22..53f7093a21b 100644 --- a/tests/components/fritz/snapshots/test_diagnostics.ambr +++ b/tests/components/fritz/snapshots/test_diagnostics.ambr @@ -52,8 +52,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'fritz', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/fritzbox/test_diagnostics.py b/tests/components/fritzbox/test_diagnostics.py index 62cbecb0472..21d70b4b6d6 100644 --- a/tests/components/fritzbox/test_diagnostics.py +++ b/tests/components/fritzbox/test_diagnostics.py @@ -30,4 +30,4 @@ async def test_entry_diagnostics( result = await get_diagnostics_for_config_entry(hass, hass_client, entries[0]) - assert result == {"entry": entry_dict | {"discovery_keys": []}, "data": {}} + assert result == {"entry": entry_dict | {"discovery_keys": {}}, "data": {}} diff --git a/tests/components/fronius/snapshots/test_diagnostics.ambr b/tests/components/fronius/snapshots/test_diagnostics.ambr index b596dbe5e1d..010de06e276 100644 --- a/tests/components/fronius/snapshots/test_diagnostics.ambr +++ b/tests/components/fronius/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'is_logger': True, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'fronius', 'entry_id': 'f1e2b9837e8adaed6fa682acaa216fd8', 'minor_version': 1, diff --git a/tests/components/fyta/snapshots/test_diagnostics.ambr b/tests/components/fyta/snapshots/test_diagnostics.ambr index 16e4724344e..5c68040f541 100644 --- a/tests/components/fyta/snapshots/test_diagnostics.ambr +++ b/tests/components/fyta/snapshots/test_diagnostics.ambr @@ -9,8 +9,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'fyta', 'entry_id': 'ce5f5431554d101905d31797e1232da8', 'minor_version': 2, diff --git a/tests/components/gardena_bluetooth/snapshots/test_config_flow.ambr b/tests/components/gardena_bluetooth/snapshots/test_config_flow.ambr index 32c0d0821e7..11a287762b9 100644 --- a/tests/components/gardena_bluetooth/snapshots/test_config_flow.ambr +++ b/tests/components/gardena_bluetooth/snapshots/test_config_flow.ambr @@ -39,8 +39,8 @@ 'address': '00000000-0000-0000-0000-000000000001', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'gardena_bluetooth', 'entry_id': , 'minor_version': 1, @@ -250,8 +250,8 @@ 'address': '00000000-0000-0000-0000-000000000001', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'gardena_bluetooth', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/gios/snapshots/test_diagnostics.ambr b/tests/components/gios/snapshots/test_diagnostics.ambr index f70c1a56b0d..71e0afdc495 100644 --- a/tests/components/gios/snapshots/test_diagnostics.ambr +++ b/tests/components/gios/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'station_id': 123, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'gios', 'entry_id': '86129426118ae32020417a53712d6eef', 'minor_version': 1, diff --git a/tests/components/goodwe/snapshots/test_diagnostics.ambr b/tests/components/goodwe/snapshots/test_diagnostics.ambr index 336e31d5bfc..f52e47688e8 100644 --- a/tests/components/goodwe/snapshots/test_diagnostics.ambr +++ b/tests/components/goodwe/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'model_family': 'ET', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'goodwe', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/google_assistant/snapshots/test_diagnostics.ambr b/tests/components/google_assistant/snapshots/test_diagnostics.ambr index a274a596e82..edbbdb1ba28 100644 --- a/tests/components/google_assistant/snapshots/test_diagnostics.ambr +++ b/tests/components/google_assistant/snapshots/test_diagnostics.ambr @@ -6,8 +6,8 @@ 'project_id': '1234', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'google_assistant', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/guardian/test_diagnostics.py b/tests/components/guardian/test_diagnostics.py index f6ee1ebcfd5..faba2103000 100644 --- a/tests/components/guardian/test_diagnostics.py +++ b/tests/components/guardian/test_diagnostics.py @@ -41,7 +41,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "data": { "valve_controller": { diff --git a/tests/components/homewizard/snapshots/test_config_flow.ambr b/tests/components/homewizard/snapshots/test_config_flow.ambr index 1d9e78eea2f..c3852a8c3fa 100644 --- a/tests/components/homewizard/snapshots/test_config_flow.ambr +++ b/tests/components/homewizard/snapshots/test_config_flow.ambr @@ -20,8 +20,8 @@ 'ip_address': '127.0.0.1', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'homewizard', 'entry_id': , 'minor_version': 1, @@ -64,8 +64,8 @@ 'ip_address': '127.0.0.1', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'homewizard', 'entry_id': , 'minor_version': 1, @@ -108,8 +108,8 @@ 'ip_address': '127.0.0.1', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'homewizard', 'entry_id': , 'minor_version': 1, @@ -148,8 +148,8 @@ 'ip_address': '2.2.2.2', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'homewizard', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr b/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr index 41e1ae81741..0e7f0028e65 100644 --- a/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr +++ b/tests/components/husqvarna_automower/snapshots/test_diagnostics.ambr @@ -175,8 +175,8 @@ }), }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'husqvarna_automower', 'entry_id': 'automower_test', 'minor_version': 1, diff --git a/tests/components/imgw_pib/snapshots/test_diagnostics.ambr b/tests/components/imgw_pib/snapshots/test_diagnostics.ambr index 1ca0c4874ea..494980ba4ce 100644 --- a/tests/components/imgw_pib/snapshots/test_diagnostics.ambr +++ b/tests/components/imgw_pib/snapshots/test_diagnostics.ambr @@ -6,8 +6,8 @@ 'station_id': '123', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'imgw_pib', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/iqvia/snapshots/test_diagnostics.ambr b/tests/components/iqvia/snapshots/test_diagnostics.ambr index 8627f31841f..f2fa656cb0f 100644 --- a/tests/components/iqvia/snapshots/test_diagnostics.ambr +++ b/tests/components/iqvia/snapshots/test_diagnostics.ambr @@ -348,8 +348,8 @@ 'zip_code': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'iqvia', 'entry_id': '690ac4b7e99855fc5ee7b987a758d5cb', 'minor_version': 1, diff --git a/tests/components/kostal_plenticore/test_diagnostics.py b/tests/components/kostal_plenticore/test_diagnostics.py index de5966c9cc7..08f06684d9a 100644 --- a/tests/components/kostal_plenticore/test_diagnostics.py +++ b/tests/components/kostal_plenticore/test_diagnostics.py @@ -56,7 +56,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "client": { "version": "api_version='0.2.0' hostname='scb' name='PUCK RESTful API' sw_version='01.16.05025'", diff --git a/tests/components/lacrosse_view/snapshots/test_diagnostics.ambr b/tests/components/lacrosse_view/snapshots/test_diagnostics.ambr index f2ff166a62e..201bbbc971e 100644 --- a/tests/components/lacrosse_view/snapshots/test_diagnostics.ambr +++ b/tests/components/lacrosse_view/snapshots/test_diagnostics.ambr @@ -15,8 +15,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'lacrosse_view', 'entry_id': 'lacrosse_view_test_entry_id', 'minor_version': 1, diff --git a/tests/components/linear_garage_door/snapshots/test_diagnostics.ambr b/tests/components/linear_garage_door/snapshots/test_diagnostics.ambr index cbbadcb63f9..c689d04949a 100644 --- a/tests/components/linear_garage_door/snapshots/test_diagnostics.ambr +++ b/tests/components/linear_garage_door/snapshots/test_diagnostics.ambr @@ -63,8 +63,8 @@ 'site_id': 'test-site-id', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'linear_garage_door', 'entry_id': 'acefdd4b3a4a0911067d1cf51414201e', 'minor_version': 1, diff --git a/tests/components/madvr/snapshots/test_diagnostics.ambr b/tests/components/madvr/snapshots/test_diagnostics.ambr index fcfcca8c960..3a281391860 100644 --- a/tests/components/madvr/snapshots/test_diagnostics.ambr +++ b/tests/components/madvr/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'port': 44077, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'madvr', 'entry_id': '3bd2acb0e4f0476d40865546d0d91132', 'minor_version': 1, diff --git a/tests/components/melcloud/snapshots/test_diagnostics.ambr b/tests/components/melcloud/snapshots/test_diagnostics.ambr index b14ecce2bb0..e6a432de07e 100644 --- a/tests/components/melcloud/snapshots/test_diagnostics.ambr +++ b/tests/components/melcloud/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'melcloud', 'entry_id': 'TEST_ENTRY_ID', 'minor_version': 1, diff --git a/tests/components/modern_forms/snapshots/test_diagnostics.ambr b/tests/components/modern_forms/snapshots/test_diagnostics.ambr index 336913dfdd4..75794aaca12 100644 --- a/tests/components/modern_forms/snapshots/test_diagnostics.ambr +++ b/tests/components/modern_forms/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'mac': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'modern_forms', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/motionblinds_ble/snapshots/test_diagnostics.ambr b/tests/components/motionblinds_ble/snapshots/test_diagnostics.ambr index 27bfa9cd041..5b4b169c0fe 100644 --- a/tests/components/motionblinds_ble/snapshots/test_diagnostics.ambr +++ b/tests/components/motionblinds_ble/snapshots/test_diagnostics.ambr @@ -18,8 +18,8 @@ 'mac_code': 'CCCC', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'motionblinds_ble', 'entry_id': 'mock_entry_id', 'minor_version': 1, diff --git a/tests/components/netatmo/snapshots/test_diagnostics.ambr b/tests/components/netatmo/snapshots/test_diagnostics.ambr index 8b775d2f1f5..463556ec657 100644 --- a/tests/components/netatmo/snapshots/test_diagnostics.ambr +++ b/tests/components/netatmo/snapshots/test_diagnostics.ambr @@ -608,8 +608,8 @@ 'webhook_id': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'netatmo', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/nextdns/snapshots/test_diagnostics.ambr b/tests/components/nextdns/snapshots/test_diagnostics.ambr index d024f54132e..827d6aeb6e5 100644 --- a/tests/components/nextdns/snapshots/test_diagnostics.ambr +++ b/tests/components/nextdns/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'profile_id': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'nextdns', 'entry_id': 'd9aa37407ddac7b964a99e86312288d6', 'minor_version': 1, diff --git a/tests/components/nice_go/snapshots/test_diagnostics.ambr b/tests/components/nice_go/snapshots/test_diagnostics.ambr index 60c43553e71..be67643c5b7 100644 --- a/tests/components/nice_go/snapshots/test_diagnostics.ambr +++ b/tests/components/nice_go/snapshots/test_diagnostics.ambr @@ -37,8 +37,8 @@ 'refresh_token': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'nice_go', 'entry_id': 'acefdd4b3a4a0911067d1cf51414201e', 'minor_version': 1, diff --git a/tests/components/notion/test_diagnostics.py b/tests/components/notion/test_diagnostics.py index 2156adfb57c..890ce2dfc4a 100644 --- a/tests/components/notion/test_diagnostics.py +++ b/tests/components/notion/test_diagnostics.py @@ -36,7 +36,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "data": { "bridges": [ diff --git a/tests/components/nut/test_diagnostics.py b/tests/components/nut/test_diagnostics.py index 948c3e9da27..2586f224d73 100644 --- a/tests/components/nut/test_diagnostics.py +++ b/tests/components/nut/test_diagnostics.py @@ -39,5 +39,5 @@ async def test_diagnostics( result = await get_diagnostics_for_config_entry( hass, hass_client, mock_config_entry ) - assert result["entry"] == entry_dict | {"discovery_keys": []} + assert result["entry"] == entry_dict | {"discovery_keys": {}} assert result["nut_data"] == nut_data_dict diff --git a/tests/components/onvif/snapshots/test_diagnostics.ambr b/tests/components/onvif/snapshots/test_diagnostics.ambr index 78191fa4600..c8a9ff75d62 100644 --- a/tests/components/onvif/snapshots/test_diagnostics.ambr +++ b/tests/components/onvif/snapshots/test_diagnostics.ambr @@ -11,8 +11,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'onvif', 'entry_id': '1', 'minor_version': 1, diff --git a/tests/components/openuv/test_diagnostics.py b/tests/components/openuv/test_diagnostics.py index cf7e7b05ec4..61b68b5ad90 100644 --- a/tests/components/openuv/test_diagnostics.py +++ b/tests/components/openuv/test_diagnostics.py @@ -38,7 +38,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "data": { "protection_window": { diff --git a/tests/components/philips_js/snapshots/test_diagnostics.ambr b/tests/components/philips_js/snapshots/test_diagnostics.ambr index 20d9b0e0023..4f7a6176634 100644 --- a/tests/components/philips_js/snapshots/test_diagnostics.ambr +++ b/tests/components/philips_js/snapshots/test_diagnostics.ambr @@ -85,8 +85,8 @@ }), }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'philips_js', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/pi_hole/snapshots/test_diagnostics.ambr b/tests/components/pi_hole/snapshots/test_diagnostics.ambr index b663f8ed57e..3094fcef24b 100644 --- a/tests/components/pi_hole/snapshots/test_diagnostics.ambr +++ b/tests/components/pi_hole/snapshots/test_diagnostics.ambr @@ -23,8 +23,8 @@ 'verify_ssl': True, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'pi_hole', 'entry_id': 'pi_hole_mock_entry', 'minor_version': 1, diff --git a/tests/components/proximity/snapshots/test_diagnostics.ambr b/tests/components/proximity/snapshots/test_diagnostics.ambr index 34bb64b3420..3d9673ffd90 100644 --- a/tests/components/proximity/snapshots/test_diagnostics.ambr +++ b/tests/components/proximity/snapshots/test_diagnostics.ambr @@ -93,8 +93,8 @@ 'zone': 'zone.home', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'proximity', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/purpleair/test_diagnostics.py b/tests/components/purpleair/test_diagnostics.py index 191115c4774..ae4b28567be 100644 --- a/tests/components/purpleair/test_diagnostics.py +++ b/tests/components/purpleair/test_diagnostics.py @@ -37,7 +37,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "data": { "fields": [ diff --git a/tests/components/rainforest_eagle/test_diagnostics.py b/tests/components/rainforest_eagle/test_diagnostics.py index e68e3cd4ce0..5aa460415b3 100644 --- a/tests/components/rainforest_eagle/test_diagnostics.py +++ b/tests/components/rainforest_eagle/test_diagnostics.py @@ -27,7 +27,7 @@ async def test_entry_diagnostics( config_entry_dict["data"][CONF_CLOUD_ID] = REDACTED assert result == { - "config_entry": config_entry_dict | {"discovery_keys": []}, + "config_entry": config_entry_dict | {"discovery_keys": {}}, "data": { var["Name"]: var["Value"] for var in MOCK_200_RESPONSE_WITHOUT_PRICE.values() diff --git a/tests/components/rainforest_raven/test_diagnostics.py b/tests/components/rainforest_raven/test_diagnostics.py index 04e125b05d9..93cf12b434f 100644 --- a/tests/components/rainforest_raven/test_diagnostics.py +++ b/tests/components/rainforest_raven/test_diagnostics.py @@ -40,7 +40,7 @@ async def test_entry_diagnostics_no_meters( config_entry_dict["data"][CONF_MAC] = REDACTED assert result == { - "config_entry": config_entry_dict | {"discovery_keys": []}, + "config_entry": config_entry_dict | {"discovery_keys": {}}, "data": { "Meters": {}, "NetworkInfo": {**asdict(NETWORK_INFO), "device_mac_id": REDACTED}, @@ -58,7 +58,7 @@ async def test_entry_diagnostics( config_entry_dict["data"][CONF_MAC] = REDACTED assert result == { - "config_entry": config_entry_dict | {"discovery_keys": []}, + "config_entry": config_entry_dict | {"discovery_keys": {}}, "data": { "Meters": { "**REDACTED0**": { diff --git a/tests/components/rainmachine/snapshots/test_diagnostics.ambr b/tests/components/rainmachine/snapshots/test_diagnostics.ambr index ed1a3dc5961..acd5fd165b4 100644 --- a/tests/components/rainmachine/snapshots/test_diagnostics.ambr +++ b/tests/components/rainmachine/snapshots/test_diagnostics.ambr @@ -1131,8 +1131,8 @@ 'ssl': True, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'rainmachine', 'entry_id': '81bd010ed0a63b705f6da8407cb26d4b', 'minor_version': 1, @@ -2262,8 +2262,8 @@ 'ssl': True, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'rainmachine', 'entry_id': '81bd010ed0a63b705f6da8407cb26d4b', 'minor_version': 1, diff --git a/tests/components/recollect_waste/test_diagnostics.py b/tests/components/recollect_waste/test_diagnostics.py index 7ae4ff4fb9c..24c690bcb37 100644 --- a/tests/components/recollect_waste/test_diagnostics.py +++ b/tests/components/recollect_waste/test_diagnostics.py @@ -33,7 +33,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "data": [ { diff --git a/tests/components/ridwell/snapshots/test_diagnostics.ambr b/tests/components/ridwell/snapshots/test_diagnostics.ambr index 9e5b4eefb3f..b03d87c7a89 100644 --- a/tests/components/ridwell/snapshots/test_diagnostics.ambr +++ b/tests/components/ridwell/snapshots/test_diagnostics.ambr @@ -34,8 +34,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'ridwell', 'entry_id': '11554ec901379b9cc8f5a6c1d11ce978', 'minor_version': 1, diff --git a/tests/components/samsungtv/test_diagnostics.py b/tests/components/samsungtv/test_diagnostics.py index 7c2fd07d322..0319d5dd8dd 100644 --- a/tests/components/samsungtv/test_diagnostics.py +++ b/tests/components/samsungtv/test_diagnostics.py @@ -42,7 +42,7 @@ async def test_entry_diagnostics( "token": REDACTED, }, "disabled_by": None, - "discovery_keys": [], + "discovery_keys": {}, "domain": "samsungtv", "entry_id": "123456", "minor_version": 2, @@ -82,7 +82,7 @@ async def test_entry_diagnostics_encrypted( "session_id": REDACTED, }, "disabled_by": None, - "discovery_keys": [], + "discovery_keys": {}, "domain": "samsungtv", "entry_id": "123456", "minor_version": 2, @@ -121,7 +121,7 @@ async def test_entry_diagnostics_encrypte_offline( "session_id": REDACTED, }, "disabled_by": None, - "discovery_keys": [], + "discovery_keys": {}, "domain": "samsungtv", "entry_id": "123456", "minor_version": 2, diff --git a/tests/components/screenlogic/snapshots/test_diagnostics.ambr b/tests/components/screenlogic/snapshots/test_diagnostics.ambr index c27e8170d3e..237d3eab257 100644 --- a/tests/components/screenlogic/snapshots/test_diagnostics.ambr +++ b/tests/components/screenlogic/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'port': 80, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'screenlogic', 'entry_id': 'screenlogictest', 'minor_version': 1, diff --git a/tests/components/shelly/test_diagnostics.py b/tests/components/shelly/test_diagnostics.py index a82ac7b7b0f..f576524ba60 100644 --- a/tests/components/shelly/test_diagnostics.py +++ b/tests/components/shelly/test_diagnostics.py @@ -45,7 +45,7 @@ async def test_block_config_entry_diagnostics( result = await get_diagnostics_for_config_entry(hass, hass_client, entry) assert result == { - "entry": entry_dict | {"discovery_keys": []}, + "entry": entry_dict | {"discovery_keys": {}}, "bluetooth": "not initialized", "device_info": { "name": "Test name", @@ -105,7 +105,7 @@ async def test_rpc_config_entry_diagnostics( result = await get_diagnostics_for_config_entry(hass, hass_client, entry) assert result == { - "entry": entry_dict | {"discovery_keys": []}, + "entry": entry_dict | {"discovery_keys": {}}, "bluetooth": { "scanner": { "connectable": False, diff --git a/tests/components/simplisafe/test_diagnostics.py b/tests/components/simplisafe/test_diagnostics.py index fb863fa3bd0..d5479f00b06 100644 --- a/tests/components/simplisafe/test_diagnostics.py +++ b/tests/components/simplisafe/test_diagnostics.py @@ -31,7 +31,7 @@ async def test_entry_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, "subscription_data": { "12345": { diff --git a/tests/components/solarlog/snapshots/test_diagnostics.ambr b/tests/components/solarlog/snapshots/test_diagnostics.ambr index 0ef8f3a735f..4b37ea63dce 100644 --- a/tests/components/solarlog/snapshots/test_diagnostics.ambr +++ b/tests/components/solarlog/snapshots/test_diagnostics.ambr @@ -9,8 +9,8 @@ 'password': 'pwd', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'solarlog', 'entry_id': 'ce5f5431554d101905d31797e1232da8', 'minor_version': 3, diff --git a/tests/components/switcher_kis/test_diagnostics.py b/tests/components/switcher_kis/test_diagnostics.py index 07a89fad7ec..53572085f9b 100644 --- a/tests/components/switcher_kis/test_diagnostics.py +++ b/tests/components/switcher_kis/test_diagnostics.py @@ -68,6 +68,6 @@ async def test_diagnostics( "disabled_by": None, "created_at": ANY, "modified_at": ANY, - "discovery_keys": [], + "discovery_keys": {}, }, } diff --git a/tests/components/systemmonitor/snapshots/test_diagnostics.ambr b/tests/components/systemmonitor/snapshots/test_diagnostics.ambr index e7a99abee5e..303074e3c2c 100644 --- a/tests/components/systemmonitor/snapshots/test_diagnostics.ambr +++ b/tests/components/systemmonitor/snapshots/test_diagnostics.ambr @@ -34,8 +34,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'systemmonitor', 'minor_version': 3, 'options': dict({ diff --git a/tests/components/tailwind/snapshots/test_config_flow.ambr b/tests/components/tailwind/snapshots/test_config_flow.ambr index 9cc1dc9c6a6..09bf25cb96e 100644 --- a/tests/components/tailwind/snapshots/test_config_flow.ambr +++ b/tests/components/tailwind/snapshots/test_config_flow.ambr @@ -22,8 +22,8 @@ 'token': '987654', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'tailwind', 'entry_id': , 'minor_version': 1, @@ -68,8 +68,8 @@ 'token': '987654', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'tailwind', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/tankerkoenig/snapshots/test_diagnostics.ambr b/tests/components/tankerkoenig/snapshots/test_diagnostics.ambr index 861509c5c85..3180c7c0b1d 100644 --- a/tests/components/tankerkoenig/snapshots/test_diagnostics.ambr +++ b/tests/components/tankerkoenig/snapshots/test_diagnostics.ambr @@ -26,8 +26,8 @@ ]), }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'tankerkoenig', 'entry_id': '8036b4412f2fae6bb9dbab7fe8e37f87', 'minor_version': 1, diff --git a/tests/components/tractive/snapshots/test_diagnostics.ambr b/tests/components/tractive/snapshots/test_diagnostics.ambr index a777107bd5e..11427a84801 100644 --- a/tests/components/tractive/snapshots/test_diagnostics.ambr +++ b/tests/components/tractive/snapshots/test_diagnostics.ambr @@ -7,8 +7,8 @@ 'password': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'tractive', 'entry_id': '3bd2acb0e4f0476d40865546d0d91921', 'minor_version': 1, diff --git a/tests/components/tuya/snapshots/test_config_flow.ambr b/tests/components/tuya/snapshots/test_config_flow.ambr index b85a8ca1dd3..a5a68a12a22 100644 --- a/tests/components/tuya/snapshots/test_config_flow.ambr +++ b/tests/components/tuya/snapshots/test_config_flow.ambr @@ -14,8 +14,8 @@ 'user_code': '12345', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'tuya', 'entry_id': , 'minor_version': 1, @@ -44,8 +44,8 @@ 'user_code': '12345', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'tuya', 'entry_id': , 'minor_version': 1, @@ -97,8 +97,8 @@ 'user_code': '12345', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'tuya', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/twentemilieu/snapshots/test_config_flow.ambr b/tests/components/twentemilieu/snapshots/test_config_flow.ambr index 2a8e389f009..a98119e81c9 100644 --- a/tests/components/twentemilieu/snapshots/test_config_flow.ambr +++ b/tests/components/twentemilieu/snapshots/test_config_flow.ambr @@ -26,8 +26,8 @@ 'post_code': '1234AB', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'twentemilieu', 'entry_id': , 'minor_version': 1, @@ -72,8 +72,8 @@ 'post_code': '1234AB', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'twentemilieu', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/twinkly/snapshots/test_diagnostics.ambr b/tests/components/twinkly/snapshots/test_diagnostics.ambr index 9274d2278ec..28ec98cf572 100644 --- a/tests/components/twinkly/snapshots/test_diagnostics.ambr +++ b/tests/components/twinkly/snapshots/test_diagnostics.ambr @@ -27,8 +27,8 @@ 'name': 'twinkly_test_device_name', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'twinkly', 'entry_id': '4c8fccf5-e08a-4173-92d5-49bf479252a2', 'minor_version': 1, diff --git a/tests/components/unifi/snapshots/test_diagnostics.ambr b/tests/components/unifi/snapshots/test_diagnostics.ambr index 11beeafdbc6..4ba90a00113 100644 --- a/tests/components/unifi/snapshots/test_diagnostics.ambr +++ b/tests/components/unifi/snapshots/test_diagnostics.ambr @@ -27,8 +27,8 @@ 'verify_ssl': False, }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'unifi', 'entry_id': '1', 'minor_version': 1, diff --git a/tests/components/uptime/snapshots/test_config_flow.ambr b/tests/components/uptime/snapshots/test_config_flow.ambr index 968093c1345..38312667375 100644 --- a/tests/components/uptime/snapshots/test_config_flow.ambr +++ b/tests/components/uptime/snapshots/test_config_flow.ambr @@ -17,8 +17,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'uptime', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/utility_meter/snapshots/test_diagnostics.ambr b/tests/components/utility_meter/snapshots/test_diagnostics.ambr index 2eec7b358c3..c69164264da 100644 --- a/tests/components/utility_meter/snapshots/test_diagnostics.ambr +++ b/tests/components/utility_meter/snapshots/test_diagnostics.ambr @@ -5,8 +5,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'utility_meter', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/v2c/snapshots/test_diagnostics.ambr b/tests/components/v2c/snapshots/test_diagnostics.ambr index 181e5094c4f..96567b80c54 100644 --- a/tests/components/v2c/snapshots/test_diagnostics.ambr +++ b/tests/components/v2c/snapshots/test_diagnostics.ambr @@ -6,8 +6,8 @@ 'host': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'v2c', 'entry_id': 'da58ee91f38c2406c2a36d0a1a7f8569', 'minor_version': 1, diff --git a/tests/components/vicare/snapshots/test_diagnostics.ambr b/tests/components/vicare/snapshots/test_diagnostics.ambr index 818aa9f226b..ae9b05389c7 100644 --- a/tests/components/vicare/snapshots/test_diagnostics.ambr +++ b/tests/components/vicare/snapshots/test_diagnostics.ambr @@ -4721,8 +4721,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'vicare', 'entry_id': '1234', 'minor_version': 1, diff --git a/tests/components/watttime/snapshots/test_diagnostics.ambr b/tests/components/watttime/snapshots/test_diagnostics.ambr index dd4252eeadd..0c137acc36b 100644 --- a/tests/components/watttime/snapshots/test_diagnostics.ambr +++ b/tests/components/watttime/snapshots/test_diagnostics.ambr @@ -18,8 +18,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'watttime', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/webmin/snapshots/test_diagnostics.ambr b/tests/components/webmin/snapshots/test_diagnostics.ambr index 5e889bd87a7..8299b0eafba 100644 --- a/tests/components/webmin/snapshots/test_diagnostics.ambr +++ b/tests/components/webmin/snapshots/test_diagnostics.ambr @@ -237,8 +237,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'webmin', 'entry_id': '**REDACTED**', 'minor_version': 1, diff --git a/tests/components/webostv/test_diagnostics.py b/tests/components/webostv/test_diagnostics.py index 74a7a50ded4..3d7cb00e021 100644 --- a/tests/components/webostv/test_diagnostics.py +++ b/tests/components/webostv/test_diagnostics.py @@ -60,6 +60,6 @@ async def test_diagnostics( "disabled_by": None, "created_at": entry.created_at.isoformat(), "modified_at": entry.modified_at.isoformat(), - "discovery_keys": [], + "discovery_keys": {}, }, } diff --git a/tests/components/whirlpool/snapshots/test_diagnostics.ambr b/tests/components/whirlpool/snapshots/test_diagnostics.ambr index b922c221908..c60ce17b952 100644 --- a/tests/components/whirlpool/snapshots/test_diagnostics.ambr +++ b/tests/components/whirlpool/snapshots/test_diagnostics.ambr @@ -29,8 +29,8 @@ 'username': '**REDACTED**', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'whirlpool', 'minor_version': 1, 'options': dict({ diff --git a/tests/components/whois/snapshots/test_config_flow.ambr b/tests/components/whois/snapshots/test_config_flow.ambr index aaf95513219..937502d4d6c 100644 --- a/tests/components/whois/snapshots/test_config_flow.ambr +++ b/tests/components/whois/snapshots/test_config_flow.ambr @@ -20,8 +20,8 @@ 'domain': 'example.com', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'whois', 'entry_id': , 'minor_version': 1, @@ -60,8 +60,8 @@ 'domain': 'example.com', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'whois', 'entry_id': , 'minor_version': 1, @@ -100,8 +100,8 @@ 'domain': 'example.com', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'whois', 'entry_id': , 'minor_version': 1, @@ -140,8 +140,8 @@ 'domain': 'example.com', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'whois', 'entry_id': , 'minor_version': 1, @@ -180,8 +180,8 @@ 'domain': 'example.com', }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'whois', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/wyoming/snapshots/test_config_flow.ambr b/tests/components/wyoming/snapshots/test_config_flow.ambr index 58617d9109d..8206c9bf20e 100644 --- a/tests/components/wyoming/snapshots/test_config_flow.ambr +++ b/tests/components/wyoming/snapshots/test_config_flow.ambr @@ -26,8 +26,8 @@ 'port': 10200, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'wyoming', 'entry_id': , 'minor_version': 1, @@ -72,8 +72,8 @@ 'port': 10200, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'wyoming', 'entry_id': , 'minor_version': 1, @@ -118,8 +118,8 @@ 'port': 12345, }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'wyoming', 'entry_id': , 'minor_version': 1, diff --git a/tests/components/zeroconf/test_init.py b/tests/components/zeroconf/test_init.py index 229329bea61..5bcff48749d 100644 --- a/tests/components/zeroconf/test_init.py +++ b/tests/components/zeroconf/test_init.py @@ -1409,42 +1409,50 @@ async def test_zeroconf_removed(hass: HomeAssistant) -> None: # Matching discovery key ( "shelly", - ( - DiscoveryKey( - domain="zeroconf", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=1, - ), - ), + { + "zeroconf": ( + DiscoveryKey( + domain="zeroconf", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=1, + ), + ) + }, ), # Matching discovery key ( "shelly", - ( - DiscoveryKey( - domain="zeroconf", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=1, + { + "zeroconf": ( + DiscoveryKey( + domain="zeroconf", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=1, + ), ), - DiscoveryKey( - domain="other", - key="blah", - version=1, + "other": ( + DiscoveryKey( + domain="other", + key="blah", + version=1, + ), ), - ), + }, ), # Matching discovery key, other domain # Note: Rediscovery is not currently restricted to the domain of the removed # entry. Such a check can be added if needed. ( "comp", - ( - DiscoveryKey( - domain="zeroconf", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=1, - ), - ), + { + "zeroconf": ( + DiscoveryKey( + domain="zeroconf", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=1, + ), + ) + }, ), ], ) @@ -1538,26 +1546,30 @@ async def test_zeroconf_rediscover( # Discovery key from other domain ( "shelly", - ( - DiscoveryKey( - domain="bluetooth", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=1, - ), - ), + { + "bluetooth": ( + DiscoveryKey( + domain="bluetooth", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=1, + ), + ) + }, config_entries.SOURCE_IGNORE, "mock-unique-id", ), # Discovery key from the future ( "shelly", - ( - DiscoveryKey( - domain="zeroconf", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=2, - ), - ), + { + "zeroconf": ( + DiscoveryKey( + domain="zeroconf", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=2, + ), + ) + }, config_entries.SOURCE_IGNORE, "mock-unique-id", ), @@ -1656,13 +1668,15 @@ async def test_zeroconf_rediscover_no_match( # Source not SOURCE_IGNORE ( "shelly", - ( - DiscoveryKey( - domain="zeroconf", - key=("_http._tcp.local.", "Shelly108._http._tcp.local."), - version=1, - ), - ), + { + "bluetooth": ( + DiscoveryKey( + domain="zeroconf", + key=("_http._tcp.local.", "Shelly108._http._tcp.local."), + version=1, + ), + ) + }, config_entries.SOURCE_ZEROCONF, "mock-unique-id", ), diff --git a/tests/components/zha/snapshots/test_diagnostics.ambr b/tests/components/zha/snapshots/test_diagnostics.ambr index 2745496256b..f46a06e84b8 100644 --- a/tests/components/zha/snapshots/test_diagnostics.ambr +++ b/tests/components/zha/snapshots/test_diagnostics.ambr @@ -93,8 +93,8 @@ 'radio_type': 'ezsp', }), 'disabled_by': None, - 'discovery_keys': list([ - ]), + 'discovery_keys': dict({ + }), 'domain': 'zha', 'minor_version': 1, 'options': dict({ diff --git a/tests/snapshots/test_config_entries.ambr b/tests/snapshots/test_config_entries.ambr index 35f6272b772..e30b2824af2 100644 --- a/tests/snapshots/test_config_entries.ambr +++ b/tests/snapshots/test_config_entries.ambr @@ -5,8 +5,8 @@ 'data': dict({ }), 'disabled_by': None, - 'discovery_keys': tuple( - ), + 'discovery_keys': dict({ + }), 'domain': 'test', 'entry_id': 'mock-entry', 'minor_version': 1, diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index ebbe4c5fa2c..57730a9f014 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -2756,11 +2756,11 @@ async def test_finish_flow_aborts_progress( [ ( {}, - (), + {}, ), ( {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, - (DiscoveryKey(domain="test", key="blah", version=1),), + {"test": (DiscoveryKey(domain="test", key="blah", version=1),)}, ), ], ) @@ -2921,108 +2921,114 @@ async def test_manual_add_overrides_ignored_entry_singleton( [ # No discovery key ( - (), + {}, config_entries.SOURCE_IGNORE, "mock-unique-id", {}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - (), + {}, ), # Discovery key added to ignored entry data ( - (), + {}, config_entries.SOURCE_IGNORE, "mock-unique-id", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - ({"domain": "test", "key": "blah", "version": 1},), + {"test": (DiscoveryKey(domain="test", key="blah", version=1),)}, ), # Discovery key added to ignored entry data ( - ({"domain": "test", "key": "bleh", "version": 1},), + {"test": (DiscoveryKey(domain="test", key="bleh", version=1),)}, config_entries.SOURCE_IGNORE, "mock-unique-id", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - ( - {"domain": "test", "key": "bleh", "version": 1}, - {"domain": "test", "key": "blah", "version": 1}, - ), + { + "test": ( + DiscoveryKey(domain="test", key="bleh", version=1), + DiscoveryKey(domain="test", key="blah", version=1), + ) + }, ), # Discovery key added to ignored entry data ( - ( - {"domain": "test", "key": "1", "version": 1}, - {"domain": "test", "key": "2", "version": 1}, - {"domain": "test", "key": "3", "version": 1}, - {"domain": "test", "key": "4", "version": 1}, - {"domain": "test", "key": "5", "version": 1}, - {"domain": "test", "key": "6", "version": 1}, - {"domain": "test", "key": "7", "version": 1}, - {"domain": "test", "key": "8", "version": 1}, - {"domain": "test", "key": "9", "version": 1}, - {"domain": "test", "key": "10", "version": 1}, - ), + { + "test": ( + DiscoveryKey(domain="test", key="1", version=1), + DiscoveryKey(domain="test", key="2", version=1), + DiscoveryKey(domain="test", key="3", version=1), + DiscoveryKey(domain="test", key="4", version=1), + DiscoveryKey(domain="test", key="5", version=1), + DiscoveryKey(domain="test", key="6", version=1), + DiscoveryKey(domain="test", key="7", version=1), + DiscoveryKey(domain="test", key="8", version=1), + DiscoveryKey(domain="test", key="9", version=1), + DiscoveryKey(domain="test", key="10", version=1), + ) + }, config_entries.SOURCE_IGNORE, "mock-unique-id", - {"discovery_key": {"domain": "test", "key": "11", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="11", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - ( - {"domain": "test", "key": "2", "version": 1}, - {"domain": "test", "key": "3", "version": 1}, - {"domain": "test", "key": "4", "version": 1}, - {"domain": "test", "key": "5", "version": 1}, - {"domain": "test", "key": "6", "version": 1}, - {"domain": "test", "key": "7", "version": 1}, - {"domain": "test", "key": "8", "version": 1}, - {"domain": "test", "key": "9", "version": 1}, - {"domain": "test", "key": "10", "version": 1}, - {"domain": "test", "key": "11", "version": 1}, - ), + { + "test": ( + DiscoveryKey(domain="test", key="2", version=1), + DiscoveryKey(domain="test", key="3", version=1), + DiscoveryKey(domain="test", key="4", version=1), + DiscoveryKey(domain="test", key="5", version=1), + DiscoveryKey(domain="test", key="6", version=1), + DiscoveryKey(domain="test", key="7", version=1), + DiscoveryKey(domain="test", key="8", version=1), + DiscoveryKey(domain="test", key="9", version=1), + DiscoveryKey(domain="test", key="10", version=1), + DiscoveryKey(domain="test", key="11", version=1), + ) + }, ), # Discovery key already in ignored entry data ( - ({"domain": "test", "key": "blah", "version": 1},), + {"test": (DiscoveryKey(domain="test", key="blah", version=1),)}, config_entries.SOURCE_IGNORE, "mock-unique-id", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - ({"domain": "test", "key": "blah", "version": 1},), + {"test": (DiscoveryKey(domain="test", key="blah", version=1),)}, ), # Discovery key not added to user entry data ( - (), + {}, config_entries.SOURCE_USER, "mock-unique-id", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.ABORT, - (), + {}, ), # Flow not aborted when unique id is not matching ( - (), + {}, config_entries.SOURCE_IGNORE, "mock-unique-id-2", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_ZEROCONF, data_entry_flow.FlowResultType.FORM, - (), + {}, ), # Flow not aborted when user initiated flow ( - (), + {}, config_entries.SOURCE_IGNORE, "mock-unique-id-2", - {"discovery_key": {"domain": "test", "key": "blah", "version": 1}}, + {"discovery_key": DiscoveryKey(domain="test", key="blah", version=1)}, config_entries.SOURCE_USER, data_entry_flow.FlowResultType.FORM, - (), + {}, ), ], ) @@ -5251,7 +5257,7 @@ async def test_unhashable_unique_id( entries = config_entries.ConfigEntryItems(hass) entry = config_entries.ConfigEntry( data={}, - discovery_keys=(), + discovery_keys={}, domain="test", entry_id="mock_id", minor_version=1, @@ -5284,7 +5290,7 @@ async def test_hashable_non_string_unique_id( entries = config_entries.ConfigEntryItems(hass) entry = config_entries.ConfigEntry( data={}, - discovery_keys=(), + discovery_keys={}, domain="test", entry_id="mock_id", minor_version=1, @@ -6186,7 +6192,7 @@ async def test_migration_from_1_2( "created_at": "1970-01-01T00:00:00+00:00", "data": {}, "disabled_by": None, - "discovery_keys": [], + "discovery_keys": {}, "domain": "sun", "entry_id": "0a8bd02d0d58c7debf5daf7941c9afe2", "minor_version": 1,