How I added a Hayward solar pool control to HA via ESPhome

UPDATED - Sept 9, 2023 - added control for valve actuator & moved to larger enclosure

Hi all,

For anybody in posterity interested in integrating a solar pool heater control to HomeAssistant via ESPHome, this is how I did it…

My solar pool heating system is controlled by a Hayward GL-235 (rebranded from Goldline).

I’m using:

  • 1 x ESP32 WROOM
  • 2 x INA219 DC Current sensors (one of them with the A0 pins connected to give me a different I2C address)
  • 1 x BH1750 lux sensor
  • 1 x Hi-Link HLK-PM03 AC to DC convertor
  • 1 x Adafruit Non-Latching Mini Relay FeatherWing (only needed for pool valve actuator)
  • 1 x 240v-24v transformer (only needed for pool valve actuator)

The concept:

There are 2 x 10K thermistors connected to the motherboard - one measures the temperature of the pool water, one measures the roof temperature. I’ve co-wired the 2 INA219s to the existing wires on the connectors to measure the voltage. I then calculate resistance & temperature from that.
I’m using the BH1750 lux sensor to measure the light level of the ‘heating’ led which tells me the system is pushing water to the roof. A text_sensor is then set to “Heating” or “Not Heating” based on the lux measured.
I pull 240V from the pool controller incoming power and use the HLK-PM03 to convert that to 3.3v

I also added a relay to be able to control a valve actuator that opens / closes my waterfall at certain intervals.

In a Fritzing diagram, it looks like this:

Note on the diagram: the model for the AC to DC is the 5V one - couldn’t find a 3.3V version :slight_smile:

Here’s the config I use for this all:

text_sensor:
  - platform: template
    name: "Pool Heating Status"
    id: esphome_pool_heating_status
    icon: mdi:heat-wave

# This switch is only needed for pool valve actuator!
switch:
  - platform: gpio
    name: "Waterfall Switch"
    id: waterfall_switch
    pin:
      number: 26
i2c:
  sda: 32
  scl: 33
  scan: true

sensor:
  - platform: ina219
    address: 0x40
    bus_voltage:
      name: "Pool Sensor Voltage"
      id: pool_voltage

  - platform: ina219
    address: 0x41
    bus_voltage:
      name: "Roof Sensor Voltage"
      id: roof_voltage
      
  - platform: resistance
    sensor: pool_voltage
    configuration: DOWNSTREAM
    resistor: 10kOhm
    name: "Pool Sensor Resistance"
    id: pool_resistance
    reference_voltage: 5V

  - platform: resistance
    sensor: roof_voltage
    configuration: DOWNSTREAM
    resistor: 10kOhm
    name: "Roof Sensor Resistance"
    id: roof_resistance
    reference_voltage: 5V

  - platform: ntc
    sensor: pool_resistance
    calibration:
      - 10.0kOhm -> 25°C
      - 32.648kOhm -> 0°C
      - 15.711kOhm -> 15°C
    name: "Pool Temperature"
    id: pool_temperature

  - platform: ntc
    sensor: roof_resistance
    calibration:
      - 10.0kOhm -> 25°C
      - 32.648kOhm -> 0°C
      - 15.711kOhm -> 15°C
    name: "Roof Temperature"
    id: roof_temperature

  - platform: bh1750
    name: "Pool LED Level"
    address: 0x23
    update_interval: 60s
    id: pool_led_level

  - platform: bh1750
    name: Pool Heating Status Sensor
    id: pool_heating_status_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: esphome_pool_heating_status
            state: !lambda |-
              if (x >= 50) {
                return "Heating";
              } else {
                return "Not Heating";
              }

And here’s what the finished board looks like mounted in a waterproof enclosure next to the controller:

And the light sensor on the controller panel:

And finally, the results in Home Assistant:

ha_card
Waterfall_on_HA

Hopefully somebody will find this useful.

1 Like

I found it very useful, Thanks! I’m trying to tap into my Autumn Solar Wintermode Solar Controller temperature readings and was wondering how you determined you could convert your temp sensors to Celsius from the resistance reading? I have attached a multi-meter to our existing temp probes (2-wire RCA connectors) and can see a voltage difference when the roof water comes in (17c-24c = 2.8v-2.6v). I was attempting to use the ADC (A0 on Wemos D1 Mini ESP8266, voltage divider supports 0-3.3v) to read and convert the voltage readings to Celsius with no luck and was just looking for a bit of advice on what to look for. Thanks.

Hi Mike, glad you found it useful - that was the purpose after all :slight_smile:

I started my search from the temp sensors and found that these were 10K thermistors for which the manufacturer had published the thermistor readings sheet. The voltages I measure were matching so I then headed onto the esphome.io pages, did some searches and found the NTC sensor.

From there I worked out that I had to measure the voltage, then calculate resistance and then temperature…

I would guess that your kit is quite similar - looking at the temperature sensors for this thing it’s just the same 2 wire thing just with an RCA for ease of use (mine just has bare wires that connect to screw terminals in the controller).

Hope this helps…
B.

1 Like

Hello Bernard,
I have finally started building something similar to your design, but I have come across a few issues which hopefully you might be able to help me with. First, what does Vin-, on the INA219, connect to in your diagram? Second, your concept description mentions using the INA219 to get the voltage, but the esphome config is using the INA219 current to calculate the resistance. What am I missing between your concept description and the implementation? Thanks!
-Mike

Hi Mike,

Let me tackle the second item first - I have no idea how I missed this (even after your previous comment :confused: ) but seems that when I created this post I used a very early version of my config which, as you rightly mention, is faulty - it is indeed not pulling the current but rather the voltage :slight_smile:
I went back and pulled the config that’s currently running on my system - I updated the post to reflect that. Hopefully this sorts out the confusion - my apologies.

Re the Vin- : I don’t have that connected at all. The positive wire coming from the sensor goes to the Vin+ and I connected the negative wire from the sensor to ground. I can’t explain it myself (I’m not very versed in electrical stuff, that’s probably clear from my above blunder as well) but when I connected the negative wire from the sensor to the Vin- I didn’t get a reading (if I remember correctly - then did some web searches and found that solution).

Hope this helps.
B.

1 Like

Legend! Thanks Mate. All working now.

1 Like