The cold weather started moving in so I set up the greenhouse again. I completely re-covered all the roof panels due to bad wind damage this Spring. I'm trying out a different idea which has more plastic wrapping around the underside and fewer staples that can rip holes through the plastic when the wind whips up. This also included an idea to close the gaps between the roof and top of the walls, which I'm happy to say was a great success. I haven't felt any wind blowing inside the greenhouse now, so it won't suck away all my heat.
I got the ESP32 set up again, but still had trouble with the relays not wanting to kick over. This was especially bad the day the sun came back out and the greenhouse temps hit 120F but the fan never came on. However I finally found the problem, and a temporary solution! The ESP32 board I'm using has 3.3v and 5v pins around the edges, and I was using the 5V pins to feed the relay. However it appears there is a regulator on the ESP that severely limits the current being fed through it, and thus starving the relay board of power. As a temporary solution I plugged in a second 5V power pack and fed this straight to the relay board (keeping common grounds between both boards. Success! All of the relays have been reliably tripping for the last three days.
To permanently resolve this problem, I have some small regulators that will take a 5V source and drop it to 3.3v @ 800mA. I think I'll wire the 5V components directly from the power supply and then power the ESP from this regulator, unless I can figure out a way to also power the ESP from a direct 5V source.
Today I've been trying to work out some code to rebuild the routine that interprets the math strings used for the relay rules. There's a technique called the shunting-yard which converts a formula into Reverse Polish Notation. From there it's supposed to be easy to work the formula. I might just do the conversion server-side and let the ESP solve the RPN string. I think that could cut out a serious chunk of processing time.
I also added in the code to perform over-the-air sketch updates. I tested it on the ESP on my desk and it works great, so I'll get it flashed to the greenhouse computer one of these days. The next thing I want to tackle is being able to store variables (such as the device name and rules table) to the ESP's flash space. Having the device name stored will allow me to have a single code image for all devices. Having the rules stored means it can take off running as soon as it boots, even without a wifi connection to the server. After a power outage or some other issue I want it to be able to kick the heaters or fans on immediately as needed, but new rules could still be updated from the web server.
So that's about it for now. I still need to work on getting the hardware into a box so everything is tidy.