As a newcomer to automation and Home Assistant, I would like to achieve the following with automations. Of course, I’ve thought about it myself. I got the idea from the following video: https://www.youtube.com/watch?v=LXEeuFdtlKQ
(German)
The hot water pump control is set to 44 °C between 2 PM and 6 PM and starts the hot water pump if not measured. This is a standard setting and works without Home Assistant, just like in the video as a “safe base.”
I have 2 relays:
Relay 1 switches the pump and heats to 55 °C.
Relay 2 even uses a heating element to heat up to a maximum of 65 °C.
A temperature sensor in the boiler is also installed by me. Everything is connected to an ESP32.
Automation
1.
I want to control my Relay 1 on the hot water heat pump to:
turn on between 10:00 AM - 7:00 PM
if I reach a supply at 500+ W with my solar/pv during the day for 20 minutes
But only once a day
and turn off if the solar power is 1 hour below 500W+ supply
(The heat pump already has a controller that turns it off once the desired temperature (55°C) is reached)
2.
I want to control my second relay, which also activates a heating element, to:
turn on between 10:00 AM - 7:00 PM
if I reach a grid feed-in > 1200 W during the day for 20 minutes, but turn it off if the feed-in drops below 1200 W for 5 minutes.
But only once a day.
And only if the solar storage is 50% full.
3.
If my temperature sensor in the boiler reports that the temperature has been 60 °C for 10 minutes in a day, the automations should not run at all for 24h.
4.
In addition, I would like to be able to manually control the switches from the dashboard without being “interfered” by the automation. Like an override over all.
Those who know or watch the video will understand that my ultimate goal would be to integrate solar/weather forecasting someday.
Since I’ve never built automations in Home Assistant before, I’m having a really hard time and would appreciate any help!
Make sure to include the “manual override” part from the start or it will get messy. This is actually tricky because you need two pieces of information: has a manual override been initiated? and whether it was manual to on or off. So one input_boolean isn’t enough. (E.g., you can’t have a “Manual Relay 1” input_boolean and use it, since you wouldn’t know if you had manually overridden it to on or off.)
For the override I would go the route of having one automation that is “Auto Hot Water Control” and when you turn that off, then you can adjust the relay switches manually.
To accomplish that, I would suggest splitting this into two parts by using separate input_booleans for “Automatic Relay 1 Setting” and “Automatic Relay 2 Setting”. Your automations would set those, but then your “Auto Hot Water Control” automation would update the real switches from those. (trigger on changes to Automatic Relay 1/2 and then set the real relays to be the same as those.) That way you can stop the auto part from affecting the relays by just turning the “Auto Hot Water Control” automation off without having to turn on/off a whole bunch of automations.
The other automations are pretty standard: trigger on state of solar supply > 500 for 20 minutes… condition between 10am-7pm… action turn on Relay 1, and a separate one for turning it off.
For the once a day, I would suggest using an input_boolean named “Relay 1 triggered today” and then have the relay automation check that it is off in its condition (so it doesn’t run again if it’s been set on) and then set it to “on” when it runs. Then have a separate automation “Reset Relay 1 Daily Check” that sets it off and triggers every day at midnight. You could have one for each relay if you wanted.
here i got my first problem. It seems that if the condition is false at the point where the pv-production is above 500 then it never starts even if the condition is true after some time.
Expl:
500 W for 20 min., 09:55, nothing happens. (right)
1500 W for >20 min, after 10am, nothing happens… (false)
@Fischje Your analysis is correct. You need to make two situations work:
triggered on >20 minutes (and between time)
at start time (and >20 minutes)
The problem is that it needs to be an OR, but if you trigger on one and then check the other you get an AND.
You can setup two automations for those, or you can have two triggers (trigger1: >20min and trigger2: at start time) and then have your conditionals be (trigger1 triggered it and between time OR trigger2 triggered it and >20 minutes) or you can setup two automations for the two cases.