Open danielBreitlauch opened 6 months ago
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (device_tracker
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
device_tracker documentation device_tracker source (message by IssueLinks)
Chiming in as well that I'm experiencing the same issue.
I only have 1 device_tracker linked to me as a person in home assistant, which is updated through a webhook that I send from my iPhone (and homekit). It's the most accurate way I've found to track whether I'm home or not. This works perfectly.
I also have an automation that when I arrive home (so my state goes from away to home) and the sun has set, that the lights on my front porch and income hall go on.
However, when HA gets restarted in the middle of the night (f.e. because watchtower updates the container), my device_tracker entity gets the state of not_home, so I'm put at away, which messes up this automation.
I tried just creating an automation that sets the state of device_tracker to home at home assistant startup (I stored the state in some boolean helper), but at home assistant startup, it starts up as away and then immediately gets set to home due to my automation, which triggers a bunch of other automations I made that trigger when I go from state "away" to "home" 🙅🏻 ....
Allright following up on this if anybody comes to the same problem. I applied a temporary fix using the uptime sensor.
If you would now restart home assistant, that would mean that your device_tracker first goes to away and then immediately switches to home due to your automation. This will trigger any automation where you define if a person is coming home, that something has to happen (not desirable behaviour).
So for every automation that you have where the trigger is " if person arrives home", add an additional condition that checks if the uptime is less than 30 seconds:
{{ (as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) >= 30 }}
That way, the automation won't trigger if home assistant has just restarted.
Same issue for me. I think this is a serious problem that should be fixed...
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
The picture says it all. The device_trackers last log entry says home/Anwesend but the state is not_home/Abwesend. It does not make sense to change the state of an entity through reboot. The entity is create through 'device_tracker.see' service calls. At bare minimum put the state change in the log but I would rather like a solution that reboots don't change state.
I know this topic came up already here, here and here but it was never really solved.
If it is a problem that multiple platforms need different defaults then at least the state should go to "unknown" and not a certain "not_home".
What version of Home Assistant Core has the issue?
core-2024.1.2
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