Automation not firing? Due to home / not_home?

I’ve an automation which doesn’t fire since I added a condition:

  - alias: iOS app wrong
trigger:
  platform: event
  event_type: timer.finished
  event_data:
    entity_id: timer.iosproblem
condition:
  - condition: state
    entity_id: device_tracker.life360_steve
    state: 'not_home'
action:
  - service: notify.steve_iphone
    data_template:
      title: "iOS app wrong"
      message: "Looks like the iOS app was probably wrong to say steve was home. Reversing the decision!"
      target: ""
  - service: mqtt.publish
    data_template:
      topic: 'monitor/steve_bt_k'
      retain: true
      payload: 'not_home'  

Basically because the iOS app isn’t as reliable as Life360 for determining if I’m REALLY home, I use a ‘check’ to see if the iOS app’s info correlates with Life360. The aim behind having all these different trackers (I also use a WiFi router device tracker and Monitor bluetooth tag tracking) is to disarm the alarm reliably.

However, since I added the condition, this automation doesn’t work anymore. Is it because I use zones, do you think, so the life360 ‘state’ won’t really be as simple as ‘not_home’ it’ll be ‘Gym’ or ‘Doctor’ or ‘Swimming’ ?? Is there a way to make the condition state is not equal to home ?

Thanks

First I think your indentation is not right, you may want to check this.
For your question about the condition, you could use this:

  condition:
    - condition: template
      value_template: '{{ states("device_tracker.life360_steve") != "home" }}'
2 Likes

Zones could potentially change state from “not_home” to “ZONE” (where ZONE is replaced by the corresponding zone). This means that HA doesn’t recognize it as “not_home” but rather as the current zone it is in.

This is the case for the ios app tracker which work pretty reliable for me. I use the tado device tracker for home/not_home states as that is all it can do (a router might do the trick as well, however you might want to set up a delay as ios tends to disconnect from wifi when it is in standby.

Do you mean the first line or somewhere else? I think the indentation is working ok? The first line is just due to what the forum textbox does/did to my code when I pasted it in and formatted it as code

yes, defo the first line. Should have had spaces in front of it.
if that’s somehow done by thos forum, then you should be ok.
Have you tried my suggestion for the templated condition?

Not yet - I am literally about to - I have “loved” it, though, as an answer.
Thank you!

1 Like

Works beautifully, thank you!

1 Like