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:
parent
1deb4c68f3
commit
4c31317c06
7 changed files with 11 additions and 11 deletions
|
@ -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)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue