WTH No entity ID in calendar automation trigger variables

I would like to get the corresponding calendar entity ID when an automation runs and triggered from a calendar.

This would allow me to do the basics like get the calendar friendly name to using a single automation that has multiple calendar triggers.

If I read the documentation right, there is no entity ID variable.

you can tag each trigger with a trigger id.

1 Like

If I have three event types on the same calendar and want each of them to do different things, I’d like to be able to assign a trigger id to each one. I don’t see a way to do that currently.

Make 3 triggers…

automation:
  trigger:
    - platform: calendar
      # Possible values: start, end
      event: start
      # The calendar entity_id
      entity_id: calendar.light_schedule
      # Optional time offset
      offset: "-00:05:00"
      id: 1

    - platform: calendar
      # Possible values: start, end
      event: start
      # The calendar entity_id
      entity_id: calendar.light_schedule
      # Optional time offset
      offset: "-00:05:00"
      id: 2

    - platform: calendar
      # Possible values: start, end
      event: start
      # The calendar entity_id
      entity_id: calendar.light_schedule
      # Optional time offset
      offset: "-00:05:00"
      id: 3

How would that tell the difference between each of these events as triggers to perform different actions (Best flow for calendar event triggered automations - Configuration - Home Assistant Community (home-assistant.io))?

By using a choose action and trigger id conditions.

It seems we’re talking past each other. Check out the screenshot from my Kiosk calendar. How would the action tell the difference between different events to run the proper script (e.g. event summary contains the word “Sleep” vs “Nutrislice)?”

How am I supposed to know you’re talking about the event name/summary not the event type which is literally a field in calendar triggers?

Anyways, use a template condition to pull the event information out.

Where is that?

In any case, I didn’t mean to make you defensive.

Also, I’m not sure if the OP marked your original reply as the Solution, but to me we need a field in calendar triggers for event summary and then we could all use Trigger ID’s as easily as any other automation trigger.

It’s not in the trigger, it’s a condition. Use a template condition, the trigger passes the trigger object

If you mean here…

…that would apply to the entire automation then…also not the appropriate flow for a single automation that should handle multiple event triggers (based on the event summaries) from a single calendar to each result in a different action.

I can’t figure out if you understand what I’m talking about or if you just don’t think it should be implemented that way. But, here’s a non-calendar example employing Trigger IDs within a single automation:

alias: Ring Zone Notifications
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.front_door
    id: Front Door Opened
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.garage_inside_door
    id: Garage Inside Door Opened
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.garage_outside_door
    id: Garage Outside Door Opened
    to: "on"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Front Door Opened
        sequence:
          - data:
              message: Front
              target: media_player.echo_kitchen
              data:
                type: tts
            action: notify.alexa_media
      - conditions:
          - condition: trigger
            id: Garage Inside Door Opened
        sequence:
          - data:
              message: Garage
              target: media_player.echo_kitchen
              data:
                type: tts
            action: notify.alexa_media
          - data:
              target: media_player.echo_garage
              data:
                type: tts
              message: Step carefully for the epoxy
            enabled: false
            action: notify.alexa_media
      - conditions:
          - condition: trigger
            id: Garage Outside Door Opened
        sequence:
          - data:
              message: Garage Outside
              target: media_player.echo_kitchen
              data:
                type: tts
            action: notify.alexa_media
          - data:
              message: Step carefully for the epoxy
              target: media_player.echo_garage
              data:
                type: tts
            enabled: false
            action: notify.alexa_media
mode: single

So, I use conditions within the action based on the Trigger ID. For calendar event triggers, I simply would like to use an automation flow similar to this but with the event summary as an additional field…it would look something like this:

  • platform: calendar
    event: start
    event_summary: “Wakeup”
    entity_id: calendar.kiosk
    id: Wakeup

…then I could use the condition: trigger and id: Wakeup in the actions for each discrete calendar event.

No… use a choose action… I said that above.

I understand what you want, please click on the link I posted above and read the words I’m writing. Anything can be done with the current system.

To reiterate:

Use a choose action.

In the choose action use a condition.

That condition can be anything, in your case, you’re going to use a template condition to get the event summary. Do whatever your heart desires when checking the summary.

I.e. if the event summary contains the words you’re looking for, then choose to perform these actions.

Yes, I know how to do that. The point of this WTH post (or so I originally interpreted…or maybe admittedly appropriated :man_shrugging:) is that templating should not be required at all for a UI based automation config flow intended to simply trigger off specific events on a calendar. To the average user, jumping in and triggering off a specific event seems uncomplicated, but templating is a more advanced capability that should not be expected of them (or anyone really given the recent efforts to simplify the UI).

I’ll submit a separate feature request later. Thanks.

This WTH was solved according to OP using trigger ids, which can all be used by the UI. I was simply answering your unrelated question.

As a sidebar, everything I’ve said can be done in the UI, even the templates. It’s a rather simple template too covered in the link above.

Anyways, if you want something point and click, then yes, you’ll need a separate feature request.

Yes, templates are available in the UI, but they’re not as approachable to the average user as simply putting a value in a text field. That’s all I’m saying.

That’s great, but this isn’t the wth to be posting on about that. :man_shrugging:

1 Like