Hello there!
This is my first post, so please let me know how to improve it!
What I want to do
I want to build a simple automation for my pool in order to replace this:
Oku Suncontrol
What this basically does is mesuring two PT100 Sensors (one for pool temp and one for solar temp) and switch a valve accordingly (“heating”: water flows through filter + solar circuit).
What I have built (hardware)
I am using the nodeMCU development board as platform.
As temperature sensors, two Dallas BM1820 will replace (and be way better than) the PT100.
The valve then will be switched by simple 230 V Relais.
The hardware works so far.
Intended algorithm
The system shall work as follows:
It shall be possible to define a desired pool temperature in HomeAssistant.
The system shall compare the actual pool temperature with the desired temperature.
If the actual temperature is below the desired and temperature AND solar temperature is above (desired temperature + hysteresis), the valve shall switch to “solar circuit”.
If the actual pool temperature goes above (desired temperature + hysteresis), the valve shall switch to “filter circuit”.
If the solar temperature drops below (desired temperature + hysteresis), the valve shall switch to “filter circuit”.
I hope it is clear what I intend to build
What I have built (software)
I managed to initialize and read the DS18B20.
I also used the “switch” template to be able to see (and manually change) the current valve state.
Therefore, I implemented two switches (“solarcircuit” and “filtercircuit”) and created a SW-interlock.
With hard-coded values, everything works as intended.
What I need help with
There is some funcionality missing that I am obviously not able to implement by myself.
So I kindly ask for Your help (as I could not find a working example in the ESPHome manual / guide or the forum yet).
-
Variables within ESPHome
Unfortunately, I was not even able to work with variables within ESPHome.
I want to have the hysteresis as variable that I can easily access within my code.
This is my first YAML project, so I really am an absolute beginner. I am kind of familiar with C-code though.
I tried this:
sensor:
- platform: dallas
address: 0x880921c10a744528
name: "Pool Temperatur"
id: pool_temperature
on_value_range:
- below: 25
then:
- lambda: |-
if (id(solar_temperature).state > (id(esp_desired_pool_temperature)+10))
{
id(filtercircuit).turn_off();
id(solarcircuit).turn_on();
}
else
{
id(solarcircuit).turn_off();
id(filtercircuit).turn_on();
}
- above: 26.5
then:
- switch.turn_off: solarcircuit
- switch.turn_on: filtercircuit
This works, but I was not able to replace the hardcoded values with variables.
-
Import a variable from HomeAssistant
As soon as working with variables within ESPHome works, I want to be able to change the desired pool temperature from within HomeAssistant.
If anyone could help me out, this would be awesome!
Also, please feel free to suggest anything else You would code differently.
Any help is appreciated!
Thank You very much in advance!