DIY Underfloor heating pump controller in Home Assistant

Hi all,

I hope you like and enjoy my Underfloor heating pump controller. It saves energy and allows for zone-based heating. Please follow the link below the openings page of the project.

This DIY controller is based on cheap hardware. It runs on ESP Home together with some additional configuration in Home Assistant. I wrote some documentation and all sources are included. If you like the project, please hit the ‘star’ in GitHub. Feedback is very welcome as well.

4 Likes

I guess i need a power meter first to see what my pump does. I’m not sure if it’s on 24/7 like yours.

Added to my evergrowing todo list :man_facepalming:t2:

Hi Vasco,

It is indeed important to know if you really have a system that doesn’t switch off. I took a Shelly socket with power reporting to HA. Run it for a few days.

I forgot to add a picture of the installed system.

2 Likes

@SuperTux nice project. I will build this myself soon as my traditional pump switch is broken :slight_smile:
Should this also work with an sonoff s26?

@Martinvdm,

Thanks for you’re question. I don’t have S26 experience, but I think it can work. The S26 is supported by ESPHome, and it is possible to connect an extra sensor. See e.g. this link: How to add AM2302 to new Sonoff S26 – Sauron's TrashPage

Great. On what pins did you solder the temp sensor? It is not really clear on the GitHub.

I have added a wiring diagram to the project description. This is a copy of the image. I hope it is clear DS18B20.drawio

1 Like

I have managed to build your project with some small modications for a S26 plug. Working very nice!

Great to hear @Martinvdm :slight_smile: I am happy it works for you.

Did you ever had this? When it is exact 01:00 at night the switch is continue on and then off again for every second. So on off on off on off etc. Seems to be something with the script anti corrosion.

@Martinvdm Thanks for the feedback. I have checked my own system and that seems to be fine. image

I think you are right, that it has something to do with the anti-corrosion cycle. This rapid on/off is not very good for the pump as well. So take care it doesn’t destroy your pump. I think that it is better to not use the switch until the problem is fixed.

I had a look at the scripts, but I am not able to see where it goes wrong.

Can you help me with additional information? Can you check the logs on the pump state, the logs on the manual/automatic mode switch, and the logs on the override switch? And maybe check the ESPHome logs around 1 o’clock in the night?

Last night same issue.
I captured a piece of esphome logging

[01:05:55][D][switch:017]: 's20_relay' Turning OFF.
[01:05:55][D][switch:037]: 's20_relay': Sending state OFF
[01:05:55][D][binary_sensor:036]: 'Pump': Sending state OFF
[01:05:56][D][dallas.sensor:136]: 'Water temperature': Got Temperature=19.4°C
[01:05:56][D][switch:013]: 's20_relay' Turning ON.
[01:05:56][D][switch:037]: 's20_relay': Sending state ON
[01:05:56][D][binary_sensor:036]: 'Pump': Sending state ON
[01:05:57][D][dallas.sensor:136]: 'Water temperature': Got Temperature=19.4°C
[01:05:57][D][switch:017]: 's20_relay' Turning OFF.
[01:05:57][D][switch:037]: 's20_relay': Sending state OFF
[01:05:57][D][binary_sensor:036]: 'Pump': Sending state OFF
[01:05:57][D][switch:013]: 's20_relay' Turning ON.
[01:05:57][D][switch:037]: 's20_relay': Sending state ON
[01:05:57][D][binary_sensor:036]: 'Pump': Sending state ON
[01:05:58][D][dallas.sensor:136]: 'Water temperature': Got Temperature=19.4°C
[01:05:58][D][switch:017]: 's20_relay' Turning OFF.
[01:05:58][D][switch:037]: 's20_relay': Sending state OFF
[01:05:58][D][binary_sensor:036]: 'Pump': Sending state OFF
[01:05:59][D][dallas.sensor:136]: 'Water temperature': Got Temperature=19.4°C

If you set manual override in ha, it seems not to work, so it continue on off rapidly. I flashed the firmware from esphome, and after boot it continues on off again. So I removed the time section and flashed, after to doing that it is controllable again.
So I think I keep skipping the time section in esphome for now and will make an automation in ha to run the pump it is hasn’t started in the past 48h.

Edit: Automation in ha:

  - alias: FloorHeatingPump Anti Corrosion
    trigger:
      platform: time
      at: '01:30:00'
    condition:
      - condition: state
        entity_id: binary_sensor.floorheatingpump_pump_state
        state: 'off'
        for:
          hours: 24    
    action:
    #turn off automatic mode
    - service: switch.turn_off
      entity_id: switch.floorheatingpump_manual_automatic 
    # turn on the pump      
    - service: switch.turn_on
      entity_id: switch.floorheatingpump_on_off 
    # wait for 1 min      
    - delay: 
        minutes: 1
    # turn off the pump
    - service: switch.turn_off
      entity_id: switch.floorheatingpump_on_off
    # turn on automatic mode
    - service: switch.turn_on
      entity_id: switch.floorheatingpump_manual_automatic 

@Martinvdm Thanks for providing the log. Great that you found a way around the problem and it works for you :slight_smile:

I am trying to understand what is happening, could you help with the logs in HA for the following entities, which are created by the ESPHome script:

- switch.on_off
- binary_sensor.pump
- switch.manual_automatic

What are they showing in the log, when the on/off flipping starts?
Last question, what are your slider threshold values?
Thanks in advance.

First all thanks :slight_smile:

  • switch.on_off
    State off

  • binary_sensor.pump
    Flipping on/off

  • switch.manual_automatic
    automatic mode , so State off

My sliders are just default 25 and 30 degrees

Hi Martin, thanks for the input. I hoped that one of the switches was flipping too, but that is not the case. I checked the S26 hardware w.r.t. the S20. No big differences. The controller chip is identical. So I don’t think the problem is in the hardware.

It keeps a mystery. To know what happens, I need to add more logging to the script. If you like we can do this together, but if you are happy with the current setup, we can leave it for now.

I already forked your GitHub and made changes for the s26 and will keep the corrosion as a automation in ha instead. Thanks for assistance

Sorry for being a dimwit, but I’m a little stuck with your solution. I managed to do the hardware part. But i don’t know what to do with the underfloor_heating_pump.yaml and how to integrate the lovellace.yaml.

for the underfloor_heating_pump.yaml i made a separate [packages] directory within the config directory and put the file in.

I also integrated within the configuration file, like:

homeassistant:
  packages: !include_dir_named packages

Is this the way? or I’m i doing stupid things here?

Some help is appreciated… Thanks!

Hi, don’t be sorry. I’m happy to respond.

It seems that the underfloor_heating_pump.yaml file is installed correctly. This file adds among others, four automations, which is shown in this picture:

The lovelace.yaml file describes the user interface of the project. To use the example user interface, create a new Home Assistant dashboard. Use the dashboard editor, and copy-paste the lovelace.yaml contents into the editor. If everything is ok, the dashboard will show the user interface.

Hi, Sorry for the late reply.

Maybe i don’t understand what you are saying with ‘use the dashboard editor’.

What i do is:

  1. Edit Dashboard
  2. Add Card
  3. Manual

and i get a card starting with

type: ''

if i paste the lovelace.yaml content in there i get

No card type found

p.s. the four automations i have. (feeling proud of myself :grinning:)

@riddertommie, this is the configuration, that includes the view as well. If this is not going to work, maybe start with some Love Lace experimenting. Just add some buttons and other stuff and inspect the raw editor, to see what happens under the hood.

title: My Home
views:
  - icon: hass:thermometer
    title: Example
    badges: []
    cards:
      - cards:
          - cards:
              - entities:
                  - entity: switch.manual_automatic_2
                    name: Automatic
                  - entity: switch.on_off
                    name: Manual override
                  - entity: binary_sensor.pump
                show_header_toggle: false
                type: entities
              - hours_to_show: 24
                graph: line
                entity: sensor.water_temperature
                name: Water temperature
                type: sensor
                detail: 1
            type: horizontal-stack
          - entities:
              - entity: input_number.threshold_temp_off
                name: Temperature pump off
              - entity: input_number.threshold_temp_on
                name: Temperature pump on
            show_header_toggle: false
            title: Thresholds automatic mode
            type: entities
        title: Underfloor heating pump
        type: vertical-stack
1 Like