Problem with a automation question

Hello again,
I´m getting more and more excited about Hassio, so I´m hope I´m not asking to much questions…

I created 2 test automation rules that triggers an notification event with an email:

> - id: '1532328312499'
>   alias: auto-test1
>   trigger:
>   - entity_id: switch.homeserver
>     from: 'off'
>     platform: state
>     to: 'on'
>   condition: []
>   action:
>     service: notify.notifyup
>     data:
>       title: Homeserver is online
>       message: Homeserver is online
> - id: '1532328808479'
>   alias: auto-test2
>   trigger:
>   - entity_id: device_tracker.ipadphilipp
>     event: enter
>     platform: zone
>     zone: zone.home
>   condition: []
>   action:
>     service: notify.notifyup
>     data:
>       title: Philipp is at home
>       message: Philipp is at hone

The first rule sends an email, that is fine. However, the second rule is supposed to send me an email when the ipad arrives at home, but it´s not executed at all, although the logbook says “ipad-philipp is at home”
Is there something wrong with the syntax?

can you format your code correctly please? (Check the blue bar on top of this page)
Also can you confirm how you track your ipad’s location? (Owntracks?HA iOS App, Google, other?)

ok…this way?

The ipad (and almost all other devices) are tracked with the Fritzbox presence detection:

ok, could it be a typo? your automation refers to ipadphilipp but you mention ipad-philipp.
Do you need the - or perhaps a _ in the name?

This is the entity´s name from hassio. I never changed that.
And this is the ipad in the known_devices.yamls:

  ipadphilipp:
    hide_if_away: false
    icon:
    mac: 34:AB:37:C9:AE:BF
    name: ipad-philipp
    picture: /local/apple.png
    track: true

ok, you can’t use this trigger with this device tracker:

basically this is what you need to read:

Zone triggers can trigger when an entity is entering or leaving the zone. For zone automation to work, you need to have setup a device tracker platform that supports reporting GPS coordinates

you need to amend your automation to be when your ipad’s status is home:

  trigger:
    platform: state
    entity_id: device_tracker.ipadphilipp
    to: 'home'

Thanks for the help, that works! :+1:

1 Like

Another thing I´m stuck with my testing: The goal is not just sending an email, but also turning on a specifc power socket for 30 seconds.
But no matter where or how I put the delay, the config check gives me an error: (I just think I havn´t understood the right synax by now)

Invalid config for [automation]: [delay] is an invalid option for [automation]. Check: automation->action->2->delay. (See /config/configuration.yaml, line 184). Please check the docs at https://home-assistant.io/components/automation/

- id: '1532328808479'
      alias: auto-test2
      trigger:
      - entity_id: device_tracker.ipadphilipp
        platform: state
        to: home
      condition: []
      action:
      - data:
          message: Philipp is at home
          title: Philipp is at home
        service: notify.notifyup
      - alias: ''
        service: switch.turn_on
        data:
          entity_id: switch.fritzpowerline01
        delay: '00:00:30'
        service: switch.turn_off
        data:
          entity_id: switch.fritzpowerline01

You have 2 occurrences of alias for starter, that should not be there
also you are listing your actions with a dash, you need one for your delay and your last action too

- id: '1532328808479'
      alias: auto-test2
      trigger:
      - entity_id: device_tracker.ipadphilipp
        platform: state
        to: home
      condition: []
      action:
      - data:
          message: Philipp is at home
          title: Philipp is at home
        service: notify.notifyup
      - service: switch.turn_on
        data:
          entity_id: switch.fritzpowerline01
      - delay: '00:00:30'
      - service: switch.turn_off
        data:
          entity_id: switch.fritzpowerline01

Thank you,
to be honest, I don´t know what these dashes mean actually, but that´s some homework for me for the weekend. :smiley:

The code is actually created from the automation editor from the web gui . Except for the delay entry, I havn´t edited it.