Timer for not_home

I try to find a solution for this.
If i am not home for more than 1 hour and come back, then start welcome sound. Now it plays when home for 1 hour....

’’’

alias: 'Welkom Home Wesley'
  trigger:
    platform: state

    entity_id: device tracer wesley
    for:
      hours: 1
      minutes: 0
      seconds: 0 
    from: 'not_home'
    to: 'home'    
  condition: 
    condition: and
    conditions: 
      - condition: time
        after: '9:00:00'    
      - condition: time
        before: '23:00:00'
  action:
    - delay:
        seconds: 1
    - service: tts.google_say
      entity_id: media_player.google_home_mini
      data_template:
        message: >
          Welcome Home Wesley

‘’’

Add an input_boolean.
Add an “away” automation that turns on the input boolean if you are away for 1 hour

Change this automation to play the sound if the input_boolean is on.
Remove he for: section of this one.
ALSO change this one to turn the input_boolean off.

@treno replied whilst I was typing, but great minds think alike :slight_smile:

alias: 'Away for an hour' 
trigger:
  platform: state 
  entity_id: device tracer Wesley 
  to: not_home
  for:
    hours: 1
action:
  service: input_boolean.turn_on
  entity_id: input_boolean.timer 
  


alias: 'Welkom Home Wesley'
  trigger:
    platform: state
    entity_id: device tracer wesley
    to: 'home'    
  condition: 
    condition: and
    conditions: 
      - condition: time
        after: '9:00:00'    
      - condition: time
        before: '23:00:00'
      - condition: state 
        entity_id: input_boolean.timer
        state: on 
  action:
    - delay:
        seconds: 1
    - service: tts.google_say
      entity_id: media_player.google_home_mini
      data_template:
        message: >
          Welcome Home Wesley
     - service: input_boolean.turn_off
        entity_id: input_boolean.timer 
1 Like

I try to understand what you mean, but where can i see that i am longer away than 1hour?

Edited the first automation, sorry forgot the important bit.

Ok tnx. I see the explanation from mf_social so i try to understand

Ok now i understand i hope.
What happends if time away is more than 1 hour? Works the same?

I hope it works like i want.
It has to notify only if more then 1 hour away
No notification if away 30mins

Try it, see how you get on, let us know what (if anything) didn’t work as desired and we can tweak it.

Thanx. I try tomorrow. Now sleeping time.
I let you know

Great! i tried this with soms test boolean switches and a shorter wait time and i think it is working!
Thank you!!

1 Like