Presence detection not triggering automation

I’m new to home assistant and I’m having trouble getting some automations to work. I installed via docker and went through the initial setup. For presence detection, I’m using asuswrt. This is what I have in my configuation.yaml

  username: admin
  ssh_key: /config/id_rsa
  port: 22
    - upload
    - download
    - upload_speed
    - download_speed

I see devices listed as home or away correctly, and have added relevant devices to the appropriate persons, which also show home or away correctly.

I set up automations through the gui, and can trigger the actions manually. The following is an example of an automation that doesn’t trigger when my device gets home.

- id: '1576998215828'
  alias: Say Hi
  description: custom greetings from google home
  - entity_id:
    event: enter
    platform: zone
    zone: zone.home
  condition: []
  - data_template:
      message: '{{ (''Welcome home. Its good to see you.'', ''Whats shakin-bacon'', ''whats-up... buttercup'' )|random }}'
    entity_id: media_player.google_home
    service: tts.google_say

In the logbook, I can see people set to away when they leave, and home when they arrive, but there isn’t any reference to the automations. Can anyone point me in the right direction to see why these aren’t working?

Just use the state change instead of the zone enter event. Like this:

  - entity_id:
    platform: state
    to: 'home'

That won’t work. your phone will most likely connect to you wifi before you even get to your front door.
Well in my case I haven’t even locked the car or walked to the front door. You need a primary trigger. External motion, front door trigger or both then a condition of a state change presence based on time from not_home to home.

Thanks I’ll give this a try and report back.

edit: This worked, the automation triggered. :slight_smile:

In my case, I notice about a 10 second delay from when my phone connects to when HA reports me as home. I’m hoping this will be enough, but I will figure out how to fine tune the timing, assuming I ever figure out how to trigger the automation in the first place.

Well this is mine

- id: '1575376714361'
  alias: George Home
  description: ''
  - entity_id: binary_sensor.front_door
    from: 'off'
    platform: state
    to: 'on'
  - condition: template
    value_template: '{{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.binary_sensor.ring_front_door_motion.last_changed))
      < 300 }}'
  - condition: template
    value_template: '{{ (as_timestamp(states.sensor.time.last_changed) -as_timestamp(
      < 300 }}'
  - condition: state
    state: home
  - data:
        method: all
        type: announce
      message: Welcome Home George
    service: notify.alexa_media_kitchen
1 Like

look at

particularly template trigger
Paulus has a great example that should work for you
that’s where i got the template from

Thanks I’ll take a look at this if I need to adjust timing.

So, if I’m understanding this correctly, the automation is triggered when your front door is opened, and the conditions require 300 seconds (milliseconds?) after there is motion at your door and you’re registered as home? I don’t have a front door sensor, so would there be any benefit to using templates over adding something like delay: 00:00:03 to the action?

delay: is just that a delay
you want to use a

as is in the example image above that Paulus has
you only need to use a template cause the data you want or need to evalute or render can’t be read directly by HA
assuming your only looking for a state change then you can just use
state as the trigger