Automation based on Google calendar event not firing

I have the following automation:

- alias: Set temp based on calendar
  trigger:
    platform: state
    entity_id: calendar.home_assistant_heating
    to: "on"
  action:
  - service: xiaomi_aqara.play_ringtone
    data:
      gw_mac: 7811dcb38199
      ringtone_id: 0
      ringtone_vol: 100

I couldn’t get the heating part working so I started with something simpeler and it turns out it’s just not activating at all. It sees the calendar, gets the data, but the automation is never triggered:

The automation is basically the same as the example in the docs so I’m not seeing what I’m doing wrong here. Does anybody see it? Thanks!

Okay, after hours of trying…turns out an event must have a duration. I put in start time 2150 endtime 2150, didn’t work. 2150-2151 does work. Next problem, I’m trying to use the data from the event to set an temperature:

1 Like

I don’t know what the rest of your code is like but this is how I did it.

I had an automation trigger an input_boolean when a calendar event happens, then other automation’s can use the status of the input_boolean as a condition of whether to run or not. At a set point each day the input_boolean gets reset back to off.

Like you mention you need a calendar event of at least 1 min.

Even got the temperature working, parsed the value in the message from the calendar as a | float and it works like a charm :slight_smile:

Would you please post your code so that I can see how you are triggering it? Thanks!

- alias: Set temp based on calendar
  trigger:
    platform: state
    entity_id: calendar.home_assistant_heating
    to: "on"
  action:
  - service: climate.set_temperature
    data_template:
      entity_id: climate.living_room
      temperature: "{{states.calendar.home_assistant_heating.attributes.message | float}}"

Voila

1 Like