Control hot water heat pump

Hello,

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!

Some thoughts:

  • 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.

I hope that’s enough to get you started.
-David

Hi,

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)

Heres my .yaml:

alias: Wärmepumpe > 500W 20min
description: ""
trigger:
  - type: power
    platform: device
    device_id: 60aa976168de9e6098cace2923bb6a1f
    entity_id: d75c3204d83c4881f99df472247658ac
    domain: sensor
    above: 500
    for:
      hours: 0
      minutes: 20
      seconds: 0
condition:
  - condition: and
    conditions:
      - condition: time
        after: "10:00:00"
        before: "17:30:00"
      - condition: numeric_state
        entity_id: sensor.sn_3017426618_battery_soc_total
        above: 30
      - condition: state
        entity_id: switch.esp32_waermepumpe_wwwp1
        state: "off"
action:
  - type: turn_on
    device_id: b8b14a153d240602a27ecbf4c92f6f53
    entity_id: 2fdf09f700c9b71f39805e5ae3f0b460
    domain: switch
mode: single

@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.

I hope that is helpful.
-David

Okay for now i have following resultion.
@dbs Maybee cause of the foreign language i don’t understand you exaclty, but i try.

This is my actual setup:

  1. Automation for a boolean Helper that is triggerd on, when the PV has 500W for 20 minutes.
- id: '1726914835952'
  alias: Helfer anstellen 500W 20 mins
  description: Wenn 500 Watt 20 minuten lang
  trigger:
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sn_3017426618_pv_power
      above: 500
    - condition: state
      entity_id: input_boolean.20_mins_500_watt_pv
      state: 'off'
    - condition: time
      after: '10:00:00'
      before: '17:55:00'
  action:
  - action: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.20_mins_500_watt_pv
  mode: single
  1. Automation Switching the Heatpump if Helper is on and time 10-18
- id: '1726915131465'
  alias: 20 mins Helfer ist an -> WP an
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: and
    conditions:
    - condition: state
      state: 'on'
      entity_id: input_boolean.20_mins_500_watt_pv
      for:
        hours: 0
        minutes: 20
        seconds: 0
    - condition: time
      after: '10:00:00'
      before: '18:00:00'
    - condition: state
      entity_id: switch.esp32_waermepumpe_wwwp1
      state: 'off'
  action:
  - type: turn_on
    device_id: b8b14a153d240602a27ecbf4c92f6f53
    entity_id: 2fdf09f700c9b71f39805e5ae3f0b460
    domain: switch
  mode: single
  1. And one single Automationturning switches off at 18
- id: '1725611633916'
  alias: Wärmepumpe nach 18 Uhr aus
  description: ''
  trigger:
  - platform: time
    at: '18:00:00'
  condition: []
  action:
  - type: turn_off
    device_id: b8b14a153d240602a27ecbf4c92f6f53
    entity_id: 2fdf09f700c9b71f39805e5ae3f0b460
    domain: switch
  - type: turn_off
    device_id: b8b14a153d240602a27ecbf4c92f6f53
    entity_id: eea2ed74cea29492b80a99845c77ed85
    domain: switch
  - action: input_boolean.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.20_mins_500_watt_pv
  mode: single