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.


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.


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


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
      platform: time
      at: '01:30:00'
      - condition: state
        entity_id: binary_sensor.floorheatingpump_pump_state
        state: 'off'
          hours: 24    
    #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