I have a question about automation in home assistant.
My goal is to switch on several lights between 3pm - 6pm but only if sun elevation is under 7.0 degrees and all mobile devices are at home.
If I come home and the devices are tracked, the lights turn on.
BUT (and that’s what I don’t understand)
If I switch on another scene with my hue dimmer, a few minutes later home assistant switches the configured scene on again as I come home right in the moment. That’s strange because I thought the devices are already tracked and marked at home and the automation has run already?
Can anyone help me out?
Maybe I can use input boolean function or something?
Well if my wife or I coming home, the light should turn on but only if the sun elevation is under 7.0 degrees and the time is after 15:00 and before 18:00.
The Automation Editor sorts options alphabetically which can make the resulting automation difficult to read (for people; Home Assistant doesn’t mind).
Yes that’s right…but what’s the main difference? My version worked, the only thing is, even if I use the dimmer remote and toggle the scenes, after a while HA runs the automation again.
I wanted to be run only once if we arriving, at the table at dinner, the lights should stay as I switched them with my remote.
The automation triggers every time either of the two device_trackers changes state to home. If you are noticing the automation triggers more than once (during the permitted time period), it suggests one of the two device_trackers is changing state. Check the history of each device_tracker during 15:00 to 18:00 and look for any additional state changes other than the initial one to home.
Ok that’s an idea. But if there is a way to use a template variable what’s triggered by the two device trackers after a few minutes in given state? I’m triggering with ping from my router and if the connection is not stable, the HA thinks I come home. Or if I use a button of the dimmer, the automation has to be stopped until I leave the house again…
So you already know that, due to connectivity issues, it’s possible for the device_trackers to be fooled into reporting you have arrived home even though you are already home.
I recommend you either correct the problems that cause ping to fail or use a completely different technique to detect presence or use several detection methods rather than just relying on one.
If you can’t do that then you can create an input_boolean that is set to on when you arrive home. Add a condition to your automation that checks if the input_boolean’s state is on.
The only challenge left is to decide what turns the input_boolean to off? You can’t use the device_tracker, when its state is not_home, because of the unstable connection. You would have to turn it off manually. However, that defeats the entire purpose of using a device_tracker. That’s why I recommended that you review and improve your current strategy for presence detection.
I been using this for a long time. And can say that that it does not work well at all. I would suggest that u don’t go on that path.
But maby u can Use a automasation that triggers on that you deactivate your alarm or unlock your door. Then it won’t re trigger sins when someone allse comes home the alarm is already deactivated.
I’ve had that it’s showing false state on devices over and over. And even had the creater look Over it together and we could come to a conclusion that
It was either homeassistant being the problem or that the code had some down sides to it.
I’d go the rout I suggested instead sins it was no back side. It just works
How about when my device tracker has an error an reports me as away for a few minutes? Then the alarm system or input_boolean will be set to off again and when it reports me again as home the automation will trigger again.
Not if it triggers on alarm being turned off. and not on home and away status. It’s no reason for it to trigger on home away status cause why would you be anything other then home if alarm is turned off
I have copied and edited all files of Phil and hoped it would work on my system. but it doesn’t.
everytime the status of my device will be showed, but for my wife the is an UNKNOWN.
I don’t understand why, the idea is to create an template sensor, which will be filled by real trackers (I have one for me and my wife). then these sensor will be called up, right?
In my case it doesn’t work with the two input selects. One will created, but the other is not existent, that is the issue with unknown. I have made two users in the group file for creating two sensors (sensor Dennis and sensor Sabrina). Mine will be filled with data from device tracker but for my wife gets nothing. Why? She has a tracker too and that gives several variables (home, not_home) but the created sensor doesn’t get those. It drives me crazy.
I’ve sitten in front of the pc now for 3 hours and read every single line of every file and can’t find it. Everything was copied 1:1 from Phil’s blog only my names and trackers was changed. What can I do.?