#Calendar event automation not working.

1 messages ยท Page 1 of 1 (latest)

keen sentinel
#

I am trying to make a automation that wishes a person happy birthday on their mobile phone.

alias: Birthday Notification
description: Wish birthday to appropriate person.
triggers:
  - entity_id: calendar.family
    event: start
    offset: "0:00:00"
    trigger: calendar
  - trigger: template
    value_template: "{{ \"Foo\" in trigger.calendar_event.summary }}"
    id: wish_foo
  - trigger: template
    value_template: "{{ \"Bar\" in trigger.calendar_event.summary }}"
    id: wish_bar
  - trigger: template
    value_template: "{{ \"Baz\" in trigger.calendar_event.summary }}"
    id: wish_baz
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - wish_bar
        sequence:
          - action: notify.mobile_app_bar
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Bar! ๐ŸŽ‰๐ŸŽ‚
      - conditions:
          - condition: trigger
            id:
              - wish_foo
        sequence:
          - action: notify.mobile_app_foo
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Foo! ๐ŸŽ‰๐ŸŽ‚
      - conditions:
          - condition: trigger
            id:
              - wish_baz
        sequence:
          - action: notify.mobile_app_baz
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Baz! ๐ŸŽ‰๐ŸŽ‚
mode: single

this is what I have ATM, I tried creating test calendar event for foo bar and baz.. and the automation doesn't seem to trigger.. I tried setting up time 15-30+ minutes from current time so the 15 min delay between updates is not a issue.

#

Am I doing something wrong?

#

I have redacted mobile_app and person names here BTW.

eternal sand
#

Only a single trigger will happen at the same time. Thus OR the calendar trigger OR the tempalte trigger. And as the template IS the trigger, the trigger variable isn't available yet.

Aka, replace the trigger conditions with the actual template trigger and remove the template triggers.

keen sentinel
#

I understood that my template trigger are acting as trigger rather then a condition to check. If I move them to the And if section in the UI, I can't add a id to these so can't use choose and triggered_by in the action..

eternal sand
#

But the trigger variable is only available after a trigger happened. Aka, they are not usable in the trigger itself as the trigger didn't happen yet.

The "And if" is the condition section of the whole automation. But every option of the chooser has it's own conditions. You conditionally want to do an action. So just add the corresponding template condition to the chooser option itself.

keen sentinel
# eternal sand But the trigger variable is only available **after** a trigger happened. Aka, th...

Hmm.. I see.. so like this?

alias: Birthday Notification
description: Wish birthday to appropriate person.
triggers:
  - entity_id: calendar.family
    event: start
    offset: "0:00:00"
    trigger: calendar
conditions: []
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ \"Foo\" in trigger.calendar_event.summary }}"
        sequence:
          - action: notify.mobile_app_foo
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Foo! ๐ŸŽ‰๐ŸŽ‚
      - conditions:
          - condition: template
            value_template: "{{ \"Bar\" in trigger.calendar_event.summary }}"
        sequence:
          - action: notify.mobile_app_bar
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Bar! ๐ŸŽ‰๐ŸŽ‚
      - conditions:
          - condition: template
            value_template: "{{ \"Baz\" in trigger.calendar_event.summary }}"
        sequence:
          - action: notify.mobile_app_baz
            metadata: {}
            data:
              message: Best wishes on your birthday!
              title: Happy Birthday Baz! ๐ŸŽ‰๐ŸŽ‚
mode: single
eternal sand
#

Yep, like that.

keen sentinel
#

I see. Let me test this one. give me 30 mins or so.

keen sentinel
#

Yep, I think it is working.

#

I'll test for more time then will mark this as resolved.