How to send mqtt messages based on google calendar

Hi,

I’m building a heating control for my home. I already have a sensor an the required actor on the thermostat connected to HA. For easier configuration, I also connected a google calendar called heating_living_room with events that contain the set temperature. For example, from today 12:15 to 13:45 the event title is “23”, as I want my home to be 23 C during this time.

I already connected the google calendar via the google calendar component, and I can see the info in HA.

I can see the message attribute containing the temperature.

My question is: What is the best approach to automate sending the required temperature to the thermostat via mqtt? Basically I want to publish the states.calendar.calendar_name.attributes.message value of sensors.heating_living_room to a specific channel. I also want to react when there is no events in the google calendar, and default to 19C.

what would be the best/correct way to solve this?

  1. In the google calendar component documentation it is writen that events can be triggerd: https://www.home-assistant.io/components/calendar.google/. The problem here is that I don’t know where this is written, in the general config yaml or in google_calendar.yaml?
  2. Should I write a python script?
  3. Can this be done with mqtt_statestream

I’m new to HA, so I would appreciate some examples if possible.
thanks!!!