#Calendar based automations not working

1 messages · Page 1 of 1 (latest)

blazing sedge
#

I have a issue with Calendar based automations.

I have created the following "test" automation. where a action needs to happen based on the event in the Calendar.

In this test automation,
if "new year" triggers, it should turn OFF a light
If "april fools" triggers it should turn ON a light

alias: Calendar events
description: Calendar Event Based Automation
triggers:
  - entity_id: calendar.heating_frontend
    event: start
    offset: "0:0:0"
    id: cal1
    trigger: calendar
conditions: []
actions:
  - data:
      message: >-
        Event Summary: {{ trigger.event.summary }}, Event Name: {{
        trigger.event.name }}
    action: system_log.write
  - choose:
      - conditions:
          - condition: trigger
            id: cal1
          - condition: or
            conditions:
              - condition: template
                value_template: "{{ 'april fools' in (trigger.event.summary | lower) }}"
              - condition: template
                value_template: >-
                  {{ 'april fools' in (trigger.event.name | lower if
                  trigger.event.name is defined else '') }}
        sequence:
          - target:
              entity_id: light.your_light_entity_id
            action: light.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: cal1
          - condition: or
            conditions:
              - condition: template
                value_template: "{{ 'new year' in (trigger.event.summary | lower) }}"
              - condition: template
                value_template: >-
                  {{ 'new year' in (trigger.event.name | lower if
                  trigger.event.name is defined else '') }}
        sequence:
          - target:
              entity_id: light.your_light_entity_id
            action: light.turn_ff
            data: {}
mode: single

#

log 1:

Logger: homeassistant.components.system_log.external
Source: components/system_log/init.py:331
integration: System Log (documentation, issues)
First occurred: 12:00:00 PM (1 occurrences)
Last logged: 12:00:00 PM

Event Summary: , Event Name:

Log 2

Logger: homeassistant.helpers.template
Source: helpers/template.py:2746
First occurred: 11:06:11 AM (24 occurrences)
Last logged: 12:00:00 PM

Template variable warning: 'str object' has no attribute 'name' when rendering '{{ 'New Year' in trigger.event.name | lower }}'
Template variable warning: 'str object' has no attribute 'summary' when rendering 'Event Summary: {{ trigger.event.summary }}, Event Name: {{ trigger.event.name }}'
Template variable warning: 'str object' has no attribute 'name' when rendering 'Event Summary: {{ trigger.event.summary }}, Event Name: {{ trigger.event.name }}'
Template variable warning: 'str object' has no attribute 'summary' when rendering '{{ 'april fools' in (trigger.event.summary | lower) }}'
Template variable warning: 'str object' has no attribute 'summary' when rendering '{{ 'new year' in (trigger.event.summary | lower) }}'
#

Note: I made most of the "template" code with the help of X/twitter's AI GROK.

It works fine for Home-assistant cards, and since I am not well versed in Templating, I wanted to see if it could help me with a automation I still needed to make