See post #1 (GitHub).
- NEW: Project ESP32CYD - ESP32 Cheap Yellow Display first prototype.
This project is a first attempt to create an ESP32 Cheap Yellow Display solution programmed with MicroPython.
From the MicroPython projects created so far, this one has been rather challenging, for various reasons, like unstable network connectivity, memory constrains, frame buffer usage, screen setup & device control --- but fun to build.
Screenshot Demo Screens
Solution - bit of a story
There are three screens defined: base screen, devices screen, device control screen.
Every screen touch is handled by a widget, like a device or button and results in an action followed by rebuilt of a screen.
The base screen is shown after ESP32CYD boots and contains a caption at the top and selective Domoticz room plan names, as menus (button widgets), at the bottom.
In the ESP32CYD configuration (config.py), the room plans with its own colors are defined.
The length of the room plan name displayed at the screen bottom, depends on the number of room plans defined and their name length.
Touching a room plan menu item, a new screen, called the devices screen, is build with the base screen plus up-to 6 devices configured in Domoticz for the room plan selected.
This is done by sending an HTTP API request to Domoticz to get the detailed devices defined for the given room plan idx … but because of memory constrains handling the Domoticz room plan detailed devices response size, a workaround with a Node-RED flow, as pre-parser has been developed and is in place
The devices are created as widgets with device name, value and optional last update.
A device is controllable depending on the device type. So far 3 controllable devices are supported: switch, dimmer, setpoint.
If a controllable device is touched, the device control screen is shown.
This screen is made out of (again) the base screen plus label widget showing the device value, two button widgets to de- or increase the value, a set button widget to update the value in Domoticz (via HTTP API request) and optional (set in config.py) the present value.
Touching a button results in de-/increasing a setpoint value with the step defined in the configuration. The device control screen is refreshed.
The solution has been developed to enable changes & enhancements, like additional controllable devices, make use of dedicated device control screens (for example a slider widget).
Examples: If a room plan changes (devices), this is immediate shown when touching the room plan menu item or add more room plans by amending the configuration.
During development experienced issues like: network connection failed during boot process, Domoticz HTTP API requests not able to handle response. Mitigation in progress, but can not confirm running stable for now.
Used garbage collection to watch & free up memory. This was quite tedious - important: the network connection must be established prior loading drivers & widgets.
The use of images has been explored, but dropped because of the memory constrains.
Also, careful use of fonts as high memory consumption. There are two fonts used with 9x11 (default, mainly for the device widget) & 23*12 (big, for menus & device control screen) size.
Installation is done by flashing the ESP32 with stable firmware, copy the project files to the ESP32, change the secrets.py with network SSID & password, define the room plans to use. Thonny used as the development tool.
Further developments will commence for a next release- as mentioned it has been challenging but fun to see the progress & result.