Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group state of device_tracker is 'on/off' and not 'home/away' after restart HA #119411

Closed
OmegaX-NL opened this issue Jun 11, 2024 · 30 comments
Closed

Comments

@OmegaX-NL
Copy link

The problem

Group state of device_tracker is 'on/off' and not 'home/away' after restart HA.

Workaround: When in 'Developer Tools' the group entity is reloaded the states are restored to 'home/away'.

What version of Home Assistant Core has the issue?

core-2024.6.2

What was the last working version of Home Assistant Core?

core-2024.5.x

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

No response

Link to integration documentation on our website

https://www.home-assistant.io/integrations/group/

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

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (group) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of group can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign group Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


group documentation
group source
(message by IssueLinks)

@tieskuh
Copy link

tieskuh commented Jun 11, 2024

I can confirm the issue
image

But the proposed workaround doesn't work for me

@dshokouhi
Copy link
Member

i see this too, only way to correct it is to reload groups.

@ADN182
Copy link

ADN182 commented Jun 11, 2024

Even if you reload, it doesn't works:

In the group.yaml file since the 2024.6.0 (tested also in 2024.6.2) :

user:
  name: Home User
  entities:
    - person.xx
    - person.yy
    - device_tracker.zz
    - device_tracker.zz

Return Home or Away

user:
  name: Home User
  entities:
    - person.xx
    - person.yy
    - device_tracker.zz
    - device_tracker.zz
    - binary.sensor.ttt

Return On or Off even if the binary sensor was a presence device class

Before 2024.6.0, Both returned Home /Away properties

@dshokouhi
Copy link
Member

reloading works for me but I only have 2 device trackers listed, and I am not sure if the issue comes again if the state changes but I do know reloading will change on to home as expected

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 12, 2024

can't replicate this, as tested in https://community.home-assistant.io/t/device-tracker-group-on-instead-of-home/736509/17?u=mariusthvdb, but suppose it can be caused by device_trackers being in a Zone, which would throw off the home/not_home only states, and then default to on/off for the group?

Scherm­afbeelding 2024-06-12 om 15 59 23

However, device_trackers can have Zones for states too and then

When a group contains entities from domains that have multiple on states or only use on and off, the group state will be on or off.

is used?

@dshokouhi
Copy link
Member

pretty sure its regression introduced in 2024.6 because none of us users had this issue before. i can see in the latest release the state logic was refactored so a likely start: #116318

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 12, 2024

yes, that seems very related.

however, even that explicitly states the multiple states for 'on' on the trackers, in this case Zones, which would then cause a group to not be 'not_home' anymore but 'off'?

Suppose that should be fixed for this specific group. lets see what the devs think of it

having said that, I just checked my only group (made to test this issue) and can see it go from 'home' before restart
Scherm­afbeelding 2024-06-12 om 16 20 02

turn unknown during startup
Scherm­afbeelding 2024-06-12 om 16 20 30

and immediately returns to 'home' after restart
Scherm­afbeelding 2024-06-12 om 16 21 22

@dshokouhi
Copy link
Member

however, even that explicitly states the multiple states for 'on' on the trackers, in this case Zones, which would then cause a group to not be not_home' anymore but off?

in that case it shouldve been marked as a breaking change because it was working fine before the release. Also its strange that device tracker is missing from the group UI.

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 12, 2024

in that case it shouldve been marked as a breaking change because it was working fine before the release

just to be 100% explicit: device_trackers in a Zone, so having the state set to the zone, did Not cause the group to go on/off before?

What was the state of the group when a tracker was eg in a Work zone?

Also its strange that device tracker is missing from the group UI.

yes, this has been asked before many times, however, not relevant to this issue now, as it has never been available and still is a FR I suppose.

btw @OmegaX-NL given this is an issue you raised on the Yaml configuration of groups, you should also post the relevant yaml in your opening post, and more detail to the issue with some screenshots. No way we can check what you are doing now, nor debug/help you

@dshokouhi
Copy link
Member

just to be 100% explicit: device_trackers in a Zone, so having the state set to the zone, did Not cause the group to go on/off before?

correct

What was the state of the group when a tracker was eg in a Work zone?

on when any tracker is home and then off when nobody is home (regardless of state)

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 12, 2024

just to be 100% explicit: device_trackers in a Zone, so having the state set to the zone, did Not cause the group to go on/off before?

correct

probably the all: true would have set the group to not_home when a single tracker was in a Zone?

What was the state of the group when a tracker was eg in a Work zone?

on when any tracker is home and then off when nobody is home (regardless of state)

but itsnt that exactly what is going on now then? the group turning on/off when in a Zone

@boheme61
Copy link

boheme61 commented Jun 12, 2024

Yes, i have 3 groups(in config.yaml), with Only device_trackers, and they show on/off, and apparently i don't see them in UI, where i only see a light-group(made in gui / Helpers) ( Not sure if i ever saw them there, it's been awhile since i created groups there :) )
Non of my 5 yaml groups is visible in Helpers

@tieskuh
Copy link

tieskuh commented Jun 12, 2024

I have the same problem but with a nested group.

Group 1 shows as on/off
Group 2 & 3 show as home/not_home

Before 2024.6 group 1 also showed as home/not_home

group1:
  name: "Group 1"
  entities:
    - group.group2
    - group.group3

group2:
  name: "Group 2"
  entities:
    - person.1
    - person.2
    
group3:
  name: "Group 3"
  entities:
    - person.3
    - person.4

@luuquangvu
Copy link

I have same problem when group members are mixed of persons and template entities.

group:
family:
name: Family
entities:
- person.person1
- person.person2
- sensor.device1_ssid_home
- sensor.device2_ssid_home

sensor.device1_ssid_home
{% if states('sensor.device1_ssid') == 'My Wifi SSID' %}
home
{% else %}
not_home
{% endif %}

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 12, 2024

This issue is about groups containing device_tracker entities

please do not add different configs and keep the issue clean

@dergreg
Copy link

dergreg commented Jun 12, 2024

I have the same issue with 2024.6.x

The topmost one is the group, the other two are the device tracker entities. You can see it even randomly switches from "home" to "on"

image

someone_home:
  name: someone
  entities:
    - device_tracker.a
    - device_tracker.b

@jontepontelinde
Copy link

I have the exact same behavior. Reloading the groups containing two different device trackers after restart makes them go back to home/not_home again.

@JimmyMPage
Copy link

JimmyMPage commented Jun 13, 2024

just to be 100% explicit: device_trackers in a Zone, so having the state set to the zone, did Not cause the group to go on/off before?

correct

This is also how my group worked before. The group would show home if a member of the group was actually home. If no member was home the group showed not_home regardless of the zones members were in (we have around 20 zones around the US that trigger various things). Now, it shows 'on' when any member is home and 'off' if no member is home regardless of what zones members are in.

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 13, 2024

as posted in the community:

fwiw, I have tested all day, and saw trackers go in and out of zones etc.

all I see is home/not_home on the group, which now consists of a mobile_app tracker, a ping tracker and a custom Composite, to have all flavors…

no issue can be forced, how odd this all is

@dshokouhi
Copy link
Member

dshokouhi commented Jun 13, 2024

as posted in the community:

fwiw, I have tested all day, and saw trackers go in and out of zones etc.

all I see is home/not_home on the group, which now consists of a mobile_app tracker, a ping tracker and a custom Composite, to have all flavors…

no issue can be forced, how odd this all is

what state do you get if you restart HA when trackers are home and in a different zone?

@jontepontelinde
Copy link

After some additional debugging I just found out it only partly works for me.
image
I have two person groups each consisting of two different device trackers. Both of these works as soon as I reload the groups after a home assistant restart.

The third group combines the two persons into one, group.persons. That one does not get the correct state even the other two gets it.

@JimmyMPage
Copy link

I had a thought that the culprit was my use of the OPNSense integration for device tracking and eliminated that from my group. Unfortunately, this change had no effect on the issue. The group still showed "on/off" after restarting Home Assistant. As before, resetting groups in Developer Tools reverted the group to "home/not_home". I'm at a loss. I sat down to start working through changing my presence detection to another scheme (binary sensors or some kind of automation that flips a switch based on state of pertinent devices). I think that's the direction I will go, but I'm taking it slow as I'm hoping this issue gets a fix.

@jontepontelinde
Copy link

jontepontelinde commented Jun 16, 2024

I just reworked my presence detection from old style groups and moved them into the person object:
image

And all of a sudden the old style group.person group works as expected, also after restarting HA.

@tjharman
Copy link

Manually reloading groups seems to fix this for me, but yea, what a PITA.
I've realised my house hasn't been setting the alarm for the last 2 weeks when we leave!!!

@pug306d
Copy link

pug306d commented Jun 17, 2024

same issue for me, manually reloading groups restores the state from on to home…

@jbouwh
Copy link
Contributor

jbouwh commented Jun 19, 2024

Should be fixed with #119789

@jbouwh jbouwh closed this as completed Jun 19, 2024
@OmegaX-NL
Copy link
Author

Just installed 2024.6.4, but the issue is still there. Can someone confirm this before I try to reopen this ticket?

Kind regards

@jbouwh
Copy link
Contributor

jbouwh commented Jun 22, 2024

Just installed 2024.6.4, but the issue is still there. Can someone confirm this before I try to reopen this ticket?

Kind regards

Fix was targetted for the beta of 2024.7

@OmegaX-NL
Copy link
Author

OmegaX-NL commented Jun 22, 2024 via email

@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests