So I decided to use UIFlow/Core2 to build a Nest-like smart thermostat. The thermostat communicates with the outside world (Home Assistant, AC Relay, Heater Relay, Fan Relay, etc.) through MQTT. All of the HVAC functionality (setting target temperature, deciding to turn on/off heat/AC, handling cycle times, swing mode, etc.) are built into my code.
You can download my code from github: https://github.com/marcvl64/M5Stack-Core2-Thermostat and also check out a screenshot of what the UI looks like.
The code is missing certain pieces (MQTT comms with HA's HVAC platform is missing), but by and far, all features mentioned above are done.
As I started adding more features, I increasingly started noticing random behavior when uploading my code to the Core2. Specifically:
-
Background color changes make certain display elements disappear. They might come back after a screen refresh (20 sec) or they might not. It's random.
-
The buttons at the bottom of the screen don't work reliably. After upload, 1 might work, sometimes 2, and if I'm lucky all 3 will work. Again random.
-
Sometimes everything just freezes for no apparent reason.
-
Sometimes when I add a completely innocent line of code (display debug info), I see odd behavior after uploading (e.g. certain screen elements that used to show up no longer show).
I have 3 questions:
1/ Am I trying to do too much with UIFlow? Have I outgrown the resources of the Core2? How would I know? How can I monitor what is going on?
2/ If yes, what would be the better development environment? Arduino?
3/ If no, what am I doing wrong?