Help with automation/scripting?

Hi,

I’m fairly new to Home Assistant and after setting up some sensors etc. I have started wondering if it can be used to implement this kind of automation.

I have a hot tub with its own heater already working in HA (I’m able to read the temperature and set the heater on/off). The heather is able to warm at 2°C/hour.

I’d like HA to read my calendar and see when I plan to use the hot tub (I have an appointment set) and activate the heater so that a defined temperature is reached in time for the appointment.

Can anyone advise if this can be accomplished with HA?

Many thanks in advance!

Here’s an outline:

  • Use google calendar to read time
  • When it will happen soon, use wait for trigger in automation with template and a bit of math
  • Turn it on

As for the math, find the difference between the current temperature and the target temperature, divide that by 2°C, and subtract that amount in hours from the start. Or

s - ((t - c) / 2°C)

Where s is start, t is target temp, and c is current temp.

thanks @KTibow!! so I understand you think it’s possible to do it right?

The first step is setting up google calendar and reading this guide (https://www.home-assistant.io/integrations/calendar.google/) I would need to use a sensor and query the attribute start_time

Will start from this now - thanks

Yeah, it’s possible. Might require a bit of work though.

I already feel it’s beyond my capabilities but will try -

the first issue is that the calendar integration guide (https://www.home-assistant.io/integrations/calendar.google/) is not saying you need to publish your project (otherwise authentication will fail)… sorted it

ok I think I mostly accomplished what I wanted and, more important learnt a lot regarding HA automations during my testing.

I had to switch to CalDAV to use iCloud and discovered that the exposed sensor will be on only at the time the event start and off at then end. Therefore I used it as trigger the Sunrise, if the calendar sensor is on it will activate the heater. Once the day is off (my event is all-day) the heater will be set off with another automation.

Will have to test it more during the following days.

Thanks again @KTibow for helping.