Implementing a temperature ramp (Homebrew Fermenter)

Hi,

With esphome I have a mini fridge implemented as a climate entity with heating and cooling capabilities. This accomplished about 90% of what I was looking for in achieving in that it is a remotely monitorable/controllable device with logs of temperature over time. However during fermentation there are times when I would like to ramp the temperature up or down over a period of time (1-3 days). I think it makes sense to implement this with HA and leave esphome for just regulating to the current setpoint. I am struggling with how to do something like this in HA though.

My first thought was a script with long waits between steps with the step interval and delta t being calculated from front end inputs. This was easy enough to implement with the pyscript integration. However, it occurred to me that tying up a thread for days is probably not good. Also if the HA server restarted an in progress ramp would be interrupted and not be able to remember what step to continue from.

After some more research I discovered helpers and thought there’s is some way to track the ramp state with a timer and counter. However, I’m sure how to implement the elements I need (init script, loop script). Plus it seems like this approach isn’t very modular since to run a different ramp in parallel all these elements would need to be duplicated taking care to not overload names. Am I missing something here? Maybe someone more knowledgeable with automations/scripting could point me in the right direction?

Thanks!

No it really doesn’t make sense to do that. Which one is more likely to be restarted, interrupting this process?

True. I guess I meant more so if the ESP gets interrupted it will forget it’s state since that sort of data isn’t typically stored in non-volatile memory with esphome. I assumed HA was able to keep track of states and thus was a superior option. Either way implementing this with esphome looks pretty straightforward with no custom component required so I will probably go that route.

Just for my understanding though, if esphome wasn’t used, how would one go about implementing this behavior with HA?

It can be. You can restore the state of variables and some components.

How about adding an SD card shield to your ESP?

Unfortunately, ESPHome doesn’t have support for this.

Luckily, someone has done this with Arduino:

I have the same use case and would like the achieve the same.
Did you manage to implement a proper solution?

I am implementing a similar thing. I use rest to import the brew data from brewfather and if the step has a ramp component the sensor calculates the time from now until the next step, divides the difference in temp and the difference in hours to get a degrees per hour and then every hour adds that amount to the set temperature. Every time the fermenter temperature changes, an automation checks the fermenter Temp to the set temp and either turns on the fridge or a heat wrap.

I’m sure you could just even set up a blueprint with some dates (or sg values if you’re using a floating hydrometer) as well as the temperature steps and have the blueprint automation control the heating/cooling.