Google Calendar automation rule best practice

I’ve a question about https://home-assistant.io/components/calendar.google/ and automation rule best practice.

If I create an 2 min calendar event in google calendar I can switch a light/lamp on for those two minutes. I’ve done this with two triggers, one for on, one for off. Here is what I have under automation:

  - alias: Turn on lounge lights for calendar event
    trigger:
      - platform: state
    entity_id: calendar.automation
    to: 'on'
    action:
      service: homeassistant.turn_on
      entity_id: switch.lounge_uprights_lamps
  - alias: Turn off lounge lights for calendar event
    trigger:
      - platform: state
    entity_id: calendar.automation
    to: 'off'
    action:
      service: homeassistant.turn_off
      entity_id: switch.lounge_uprights_lamps

Is that reasonable or should I be using the end time parameter?

1 Like