#Choose action not working as should (and other questions)
75 messages · Page 1 of 1 (latest)
That happens when none of them are true
If peaches and animeking are both not home that will be the case, also you probably need home/not_home in quotation marks
Post the YAML for the automation.
Duh... I can read. lmfao
for the condition, i'm home so it should work as i tried to run manually
Try "home" not home
Might even need to be capitalised H if that's the state that's reporting
Remove lines 10, 28, and 57. Conditions are AND by default as well.
Hmmm
So, if you are home, but peaches isn't, it should do one thing. If peaches is home and you aren't, it should do something else?
Do a test on each condition in the UI and see what it reports:
> Test
for the first condition peaches being away did not pass, the rest did?
Because it's an AND, all the conditions have to pass.
You could switch that to an OR, but I don't think the logic you want would work that way.
i removed and and it still did not pass.
she is away right because she is not home?
Conditions are AND by default.
Tbh choose is probably just the wrong option here anyway
oh?
You can wrap them in an OR clause, but that changes the logic from "all these conditions" to "any of these conditions".
what about
`condition: not
conditions:
- condition: state
entity_id: person.peaches
state: home`
Nah, that just inverts the logic. It's syntatically the same as "not_home".
Choose is normally for exclusive options: choose a if x=1, b if x =2, c if x = 3 etc here you have multiple options
yeah as if she is not home then run that automation?
oh ok what would be the best for multiple options?
So, try this in the template editor (dev tools):
{{ is_state("person.peaches", "not_home") and is_state("person.animeking", "home") and is_state("binary_sensor.mr_cooper", "on") }}
results: false
I would change it to:
If peaches away
If anime king home
If Cooper on
Thing a
Else
Thing b
End if
End if
Else
If announcements off
Thing c
End if
End if
It also has the advantage of showing you where the logic is failing if you look at that in the trace
What about:
{{ states("person.peaches") }}
{{ states("person.animeking") }}
{{ states("binary_sensor.mr_cooper") }}
that worked. if-then worked.
my question would be. when is a time i would need the choose action then?
Ahhhh, actually, I know why it failed with the Choose.
person.peaches is "J & S Plating and Repair". So, she's not home and notnot_home. So, your original logic was correct.
You can account for that by wrapping their condition in a NOT and use home as a condition. That will take care of different zone names.
@ebon wadi for another automation i need help with do i have to create another post for it?
Nah... go ahead and post it here.
Choose action not working as should (and other questions)
I have made an home/ away alarm system based on me and my wife status. For some reason it has not triggered once. The automation is supposed to trigger when we are both away from home. once we are coming back to the house in a certain distance it turns on certain entities before we get home. https://dpaste.org/0MUHH
Same thing... Use a NOT condition and "home" as the value to check against. OR, you could use a numeric_state trigger on your home zone and test for anything above 0.
So, I use a template binary sensor helper for this. It simply is {{ states("zone.home") | int(0) > 0 }}. Name it "Someone at home" and then you can use that as a trigger.
And you can create another template binary sensor helper for "Everyone at home" as well. {{ states("zone.home")|int(0) == [how many people live in your house] }}.
question which trigger would i replace with the new trigger?
also the > 0 is the distance correct?
Eh, your triggers are actually fine. Those would be more apt for your conditions. Basically if you don't care who is getting home, you could just test the "Someone is home" sensor on/off and that will account for you or your wife or anyone else coming or leaving home.
There are no traces at all for this automation?
Like it's not triggered on anything?
yes and i made this automation a month ago. so something should have triggered?
If you go into dev tools >states and change the sensor.home_nearest_distance to 0 then change it again to 7, does the automation trigger?
I mean... maybe you and your family hasn't left the house in a month... 🤣 😉
i will have to wait to test when i go to lunch. if it does work it will turn off my work computer as i work from home lol.
not likely lol.
lol try this (if you have the time). Disable this automation and create a new one with the same triggers and don't add any actions or conditions to it. Just the triggers.
That way you can test things without it affecting anything.
Done. noe go to dev tools?
Yup
You don't have any other automations that trigger off proximity, do you?
If so, you'll want to disable those too.
no only that
Ok, yeah... mess with the value of that sensor in dev tools.
You new automation should trigger.
yeah something wrong with that automation. the test triggered, but the old one still says no trace
Ok, let me take another look at it.
What about if you set zone.home to 0 and then something like 4?
It should trigger on that one too.
i just deleted the old one and updated the new one with the actions. ill just test the actions on my lunch and let you know the results. so far the distance triggers the automation.
@ebon wadi it works now with the test i did. IDK the previous automations just did not work at all
Huh, maybe there was something wonky with it. I’ve had that happen a couple of times. That’s why I suggested testing it with the new automation.
Careful with this one, the not_home state is really “not in any named zone” which is different than != 'home'