#Choose action not working as should (and other questions)

75 messages · Page 1 of 1 (latest)

somber frigate
#

I have a choose action that triggers when its a certain time. When it runs, it does not choose any action at all.
https://dpaste.org/9jwVk

quick imp
#

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

ebon wadi
#

Post the YAML for the automation.

ebon wadi
#

Duh... I can read. lmfao

somber frigate
quick imp
#

Try "home" not home

#

Might even need to be capitalised H if that's the state that's reporting

ebon wadi
#

Remove lines 10, 28, and 57. Conditions are AND by default as well.

somber frigate
quick imp
#

Hmmm

ebon wadi
#

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: dotsvertical > Test

somber frigate
#

for the first condition peaches being away did not pass, the rest did?

ebon wadi
#

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.

somber frigate
#

she is away right because she is not home?

ebon wadi
#

Conditions are AND by default.

quick imp
#

Tbh choose is probably just the wrong option here anyway

ebon wadi
#

You can wrap them in an OR clause, but that changes the logic from "all these conditions" to "any of these conditions".

somber frigate
#

what about
`condition: not
conditions:

  • condition: state
    entity_id: person.peaches
    state: home`
ebon wadi
#

Nah, that just inverts the logic. It's syntatically the same as "not_home".

quick imp
#

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

somber frigate
somber frigate
ebon wadi
#

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") }}
quick imp
#

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

ebon wadi
somber frigate
#

my question would be. when is a time i would need the choose action then?

ebon wadi
#

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.

somber frigate
#

@ebon wadi for another automation i need help with do i have to create another post for it?

ebon wadi
#

Nah... go ahead and post it here.

#

Choose action not working as should (and other questions)

somber frigate
#

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

ebon wadi
#

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] }}.

somber frigate
#

also the > 0 is the distance correct?

ebon wadi
#

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?

somber frigate
ebon wadi
#

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?

ebon wadi
somber frigate
ebon wadi
#

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.

somber frigate
ebon wadi
#

Yup

#

You don't have any other automations that trigger off proximity, do you?

#

If so, you'll want to disable those too.

somber frigate
ebon wadi
#

Ok, yeah... mess with the value of that sensor in dev tools.

#

You new automation should trigger.

somber frigate
#

yeah something wrong with that automation. the test triggered, but the old one still says no trace

ebon wadi
#

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.

somber frigate
somber frigate
#

@ebon wadi it works now with the test i did. IDK the previous automations just did not work at all

ebon wadi
#

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.

deep venture
ebon wadi
#

Yeah, I know. But it does help when one really just cares if someone is home or not home and has multiple zones setup.

#

But, it's also why I lean more on the zone status count over named zones.