Preamble:
I have a keezer (kegerator freezer) for my homebrewing. Currently, I have an ESP8266 with a Dallas probe which reads the temp into my HA setup and also controls a circulation fan through Lovelace. Temperature control is via an Inkbird which is repeatedly going screwy and I want to replace it.
It seems that the obvious solution is to use the ESP8266 temp readings from the Dallas to operate a relay switch based on a high/low temp range which I’m happy to set in the code as it doesn’t change. I can get it to do that but I’m getting held by by the additional requirement to have a compressor delay to prevent burnout.
Problem:
I need to add code to the base that I have that will allow me to set a high/low range, lets say 0C/32F is low and 4C/39F high. When the keezer warms to 39F, it will kick in the compressor which will cool to 32F then turn off and STAY OFF for a set number of seconds, even if the keezer warms up beyond 39*F during that period.
Has anyone figured out that kind of solution? I did a search but didn’t turn up anything that made sense. My current code is below:
You should be able to use on_value_range to start run a script, wait_until the temp is cool enough and then have a wait for however long you want your debounce to be.
That looks like a simple solution but in my mind, here is how it runs:
** Compressor turns on (keezer_fan in the code example in your post) and starts cooling until the Dallas hits 32*F (you have 4 in your post)
** Compressor turns off and waits set time (60 secs in your code). After set time, the code runs again and if the temp is below the set value, it goes back into another set wait loop.
** Once the temp is above the set temperature, it turns the compressor back on and the whole thing repeats.
In this case, the compressor control (switch on/switch off) becomes time based rather than temperature based; the decision is binary as being either above or below the set temp and the set time controls how often that is checked. I played around with something similar with ‘above’ and ‘below’ temperatures which seemed to work but doesn’t build in the compressor delay. The beauty of your example could lie in the simple ‘wait’ element coupled with the ‘above’ and ‘below’ thresholds.
I’ll try to get time to work on it over the weekend and if I get it running, I may create a blueprint.
@nickrout - I’ll look into the climate component. I hadn’t considered that.
I’m sorry, I didn’t have a full example in here. The part you’re missing is the part that runs the script when it gets above the target temperature. (Also, I put 4 because your sensor is in C, not F so 32 would be way too warm in C)
So in this if the value is above 4C then it’ll execute the script cooldown which will turn on the fan, run until the temp is below 0C, wait 60s and then exit. This will then be fired again if the dallas sensor gets above 4C.
I also corrected the temperature in the script to be your lowest target of 0C.
I got it uploaded. I’ll post back here with the results.
Sidebar question: Is there a way to monitor when the script is triggered? It doesn’t show up as an entity. I’d like to just record when it runs, when it stops etc for debug purposes.
Thanks for your help so far, it got me way further than I had managed alone. I haven’t used scripts in the YAML code before, I just but the automations in the HA automation section. Always love to learn new stuff.
It seems that @pcon was on point for simplicity and function. I didn’t try the climate controller function because this solution was simple and easy to implement and I can confirm that it is working as expected.
Many thanks Patrick and Nick for you assistance. I’ll post the working code here for anyone else that needs it. For reference, I’m running this on a Wemos D1 Mini with a 4-relay board connected to D5 (relay #1), D6 (relay #2), D7 (relay #3). The fourth relay will run my line cooler to the taps when I get around to it.