#Area aliases work

1 messages ยท Page 1 of 1 (latest)

arctic salmon
#

Moved conversation from the thread, since it's closed now.
@honest depot when you have a minute, could you briefly check my questions please?

  1. In your PR (https://github.com/home-assistant/core/pull/118995, closed now) you change async_get_area_by_name function. But as i see nowhere in HA repo this method is actually used with aliases... Does it mean that some other code is using it outside of HA_core, and changing this method will be enough? Where's it used in Assist, so i could check?
  2. I saw you taking just first result in that for-loop. That means, if two areas have duplicated aliases (it's possible, i tried), then only first one in registry list will be always returned. Shouldn't we change this behaviour, and, say, throw error if there's more than one area with given alias? I understand that it could break some places, so probably we leave this method alone, and use new one get_areas_for_alias, similar to get_areas_for_label, and treat its multiple output in caller?
  3. Do you want me to add same functionality for Floors? If so, the questions 1 and 2 will be the same.
honest depot
#

Hi @arctic salmon,

  1. The function is meant to be used in Jinja templates. Assist will return the name of the area you talk about, which may be an alias. As of right now, using an alias means you can't map it back to an area id in an automation or response.
  2. I think the only "solution" to this would be to provide a floor as well. If you have areas with the same alias on the same floor, then you must have a good reason ๐Ÿ˜„ It's a toss up to me if it's better to throw an error just return the first match.
  3. Yes, we would need the same functionality for floors. And my answers would be similar: if you have two floors with the same alias, you must have a good reason (though I would be in support of blocking this in the frontend).
arctic salmon
arctic salmon
arctic salmon
arctic salmon
#

@honest depot @torn summit is there any ongoing issue with Github? My PR failing tests on modules i never touched (locally passes same files too)...

fluid bane
#

That happens sometimes. Try rebasing your PR so the CI checks run again

torn summit
#

Please avoid pinging for reviews

#

thanks! ๐Ÿ‘

fluid bane
#

he was just asking why unrelated tests fail, to be fair

arctic salmon
arctic salmon
honest depot
oak pier
#

Is there currently a way to work around this as it doesn't seem to be released yet.

arctic salmon
#

No. Awaiting for review.. it should've been in 2024.12.0, but probably Paulus had no time to review it...