core icon indicating copy to clipboard operation
core copied to clipboard

Area filter (automations) does not work correctly

Open StefanDorschu opened this issue 1 year ago β€’ 10 comments

The problem

When applying a filter (area) in the automation overview (settings -> automations) the areas are not filtered correctly (s. attached picture).

In the attached example i want to show only automations which have been assigned to the area "Flur (Technik)". Nevertheless an automations is shown which belongs to the area "Garten".

Bildschirmfoto 2024-04-18 um 10 04 02

What version of Home Assistant Core has the issue?

core-2024.4.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

StefanDorschu avatar Apr 18 '24 08:04 StefanDorschu

Even changing the area does not change the behaviour. Somethings seems to be stuck.

StefanDorschu avatar Apr 18 '24 08:04 StefanDorschu

I think it may be duplicate of #20381. Unfortunately, we didn't found the cause yet.

silamon avatar Apr 25 '24 15:04 silamon

As your linked duplicate has been solved, any further investigation in this? Even adding a new automation with the same yaml-code (copy-paste) show the same behaviour.

Any idea what to look for?

StefanDorschu avatar May 11 '24 06:05 StefanDorschu

Check if you have any errors in the logbook (config > system > logbook)? If it looks the same as https://github.com/home-assistant/frontend/issues/20381#issuecomment-2041415742, then it's a duplicate.

silamon avatar May 11 '24 06:05 silamon

I dont see any similar. (no automation related errors at all)

My only idea is that it has to do with some kind of identifier which is written when the automation was once created.

When i create another automation from scratch copying this code (this is the code of the original automation):

`description: >- Aufgrund des Standby-Verbrauchs werden die Spots nur nach Bedarf mit Strom versorgt. trigger:

  • platform: state entity_id:
    • light.garten_spots_grill_kombiniert
    • light.garten_holzbackofen to: "off" for: hours: 0 minutes: 0 seconds: 13 condition:
  • condition: state entity_id: switch.garten_spots_grill state: "on"
  • condition: state entity_id: light.garten_spots_grill_kombiniert state: "off" for: hours: 0 minutes: 0 seconds: 10
  • condition: state entity_id: light.garten_holzbackofen state: "off" for: hours: 0 minutes: 0 seconds: 10 action:
  • service: switch.turn_off data: {} target: entity_id: switch.garten_spots_grill mode: single`

Saving it with a new name, giving it a different area (or even leave it empty), it shows up under the area i mentioned in my first post.

StefanDorschu avatar May 11 '24 06:05 StefanDorschu

The problem still exists for me

StefanDorschu avatar Jul 04 '24 20:07 StefanDorschu

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

The issue still exists for me.

StefanDorschu avatar Oct 04 '24 21:10 StefanDorschu

Is there any way to check which area an automation belongs to (because obviously the in the area configured through the ui is not correct)

StefanDorschu avatar Oct 04 '24 22:10 StefanDorschu

To make it clear. I shows up when using a filter with the intended area but it also shows up when filtering for another area.

StefanDorschu avatar Oct 05 '24 22:10 StefanDorschu

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

The problem still exists. Here is another example:

Bildschirmfoto 2025-01-05 um 09 11 05

As you can clearly see i just selected the area (Bereich) "Emmas Zimmer" although the areas "Allgemein" and "Stellas Zimmer" are also listed. When i open the individual automation, their area is correct.

StefanDorschu avatar Jan 05 '25 08:01 StefanDorschu

When you're clicking the area filter, does the table change anything at all? It's been a while since I was in this issue, and the causes of the other issues all pointed to invalid automations.

silamon avatar Jan 05 '25 08:01 silamon

When i select other areas the corresponding automations are shown.

Bildschirmfoto 2025-01-05 um 09 27 07

StefanDorschu avatar Jan 05 '25 08:01 StefanDorschu

Is the a way to connect to the database and check which area is really saved for that automation?

I guess area filter is just a database select like "select allautomations where area="xxx"", correct?

StefanDorschu avatar Jan 05 '25 08:01 StefanDorschu

So some areas work and some not? I don't have areas already consisting of multiple words, perhaps it's not working for these?

It's in your config folder, then folder ".storage", then file core.entity_registry. There's also a file "core.area_registry" where the definition of areas are saved.

silamon avatar Jan 05 '25 08:01 silamon

I seems like there are multiple areas stored for one automation.

Looking at these files that entries seem to be ok (as far as i understand it), so these file do not show that there are multiple entries.

Same problem between areas that consist just of one word.

How is the filtering done? Where can i find the corresponding code?

Thanks for your help!

Bildschirmfoto 2025-01-05 um 10 28 42

StefanDorschu avatar Jan 05 '25 09:01 StefanDorschu

I did some tests, it seems most likely it occurs when duplicating an automation, even if i do add the correct area when saving the automation after duplication. (I am running 2025.1 but i have this problem since release of the area filtering)

Example

I duplicating an automation "Emmas Automation" that is assigned to area "Emmas Zimmer".

I save the duplicate with the new name "Stellas Automation" and assign it to "Stellas Zimmer".

The result is that "Stellas Automation" is shown when filtering the area for "Emmas Zimmer" or filtering for "Stellas Zimmer). (no, i unchecked all filters before filtering for the new area)

StefanDorschu avatar Jan 05 '25 09:01 StefanDorschu

Hm, after replacing all occurences of entities with the name emma in this automtion, it disappeared filtering for "Emmas Zimmer" and just shows up when filtering for "Stellas Zimmer".

I have not proven it yet (edit: checked for multiple automations, its very likely), but could it be that the area filter does also filter all entities? (So the filter is just using the core.entity_registry without checking if the entity is an automation) So if there is an entity that is assigned to another area, the automation is also shown when filtering for the other area?

I think that very likely but at least for me not what i would expect when filtering for an area. (i would expect only the assigned area of the automations to be relevant)

StefanDorschu avatar Jan 05 '25 10:01 StefanDorschu

It starts with automations only and uses the area_id to filter. There are no entities involved beside automations. I have tried duplicating an existing automation and assigning it to a different area and it works like it should.

silamon avatar Jan 05 '25 10:01 silamon

I created a new automation from scratch, assigned it to area "Alte KΓΌche" but using an entity of area "Garten" in this automation.

The automation shows up for both areas.

Bildschirmfoto 2025-01-05 um 11 44 53 Bildschirmfoto 2025-01-05 um 11 45 11 Bildschirmfoto 2025-01-05 um 11 45 18

StefanDorschu avatar Jan 05 '25 10:01 StefanDorschu

Is this filtering for automations and all other entities what is intended?

StefanDorschu avatar Jan 06 '25 21:01 StefanDorschu

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still waiting on a reply :)

StefanDorschu avatar Apr 08 '25 07:04 StefanDorschu

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.