Notify my wife when i leave work

Hi homie !

I’ve got some issue with this automation, i tried to send a notification to my wife’s phone when i leave my work but can’t make it work.

Here is the code :

alias: "when_pa_leave_work"
trigger:
  - platform: state
    entity_id: device_tracker.bla_l09
    from: 'travail_pa'
    to: 'away'
condition:
  - condition: time
    after: '17:50:00'
    before: '20:00:00'
    weekday:
      - mon
      - tue
      - thu
      - fri
      - sat
action:
  - service: notify.mobile_app_bkl_l09
    data_template:
      message: "P.A. vient de partir du boulot"

Have you got some tips for me please? :relaxed:

well, basic stuff first: trigger your automation without conditions to see if it works, then with conditions.
if both work, your trigger is wrong.
I don’t know anything about trackers so that’s it from me :wink:

1 Like

Instead of ‘away’ try ‘not_home’.

Use a zone trigger instead of state trigger

3 Likes

that’s more like it.

Woaw! so many people to help me! Thanks a lot @tom_l @AhmadK @Marsman :grin:

I’ll try your solutions tomorrow and come back here to tell if it’s working.

i had a similar problem with the same notification intent :slight_smile:
and the only way I got it working was using the Zone trigger as @Marsman suggests

Hi !

As @tom_l and @Marsman suggested, use not_home instead of away and use a zone trigger.
Here’s my config where I broadcast when I leave work if there’s anybody home, and include my ETA from the Waze sensor :wink:

Hope it helps !

So i did a test today and it’s working!

This is what i’ve done:

I tried to replace “state” by “zone” as trigger but home assistant told me there was something wrong with my automation.

I tried this but didn’t change anything.

Here i saw that i used the device name for the entity (device_tracker.bla_l09) in state of the owner name (for here: person.p_a)

So thanks a lot all for your help !

PS: @Twan Also love classic 21 radio :wink:

Glad you made it work ! :slight_smile:

Also, do not forget to link your tracker to the right person :
image

PS: I had to be quite clever to make Classic21 to play on my Google Home devices :wink: