Key Huawei LTE routers in hass.data by config entry rather than unique id (#85788)

Key routers in hass.data by config entry rather than unique id

There's no particular reason to key them by the unique id; the config
entry id is a stronger, always available guarantee, and a much more
common convention across the HA codebase.

At some point, we might conceivably support devices we can't find a
proper unique id for; this would work for that purpose as well.
This commit is contained in:
Ville Skyttä 2023-01-13 10:20:24 +02:00 committed by GitHub
parent 1deb4c68f3
commit 4c31317c06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 11 deletions

View file

@ -627,7 +627,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up from config entry."""
router = hass.data[DOMAIN].routers[config_entry.unique_id]
router = hass.data[DOMAIN].routers[config_entry.entry_id]
sensors: list[Entity] = []
for key in SENSOR_KEYS:
if not (items := router.data.get(key)):