(Tested and Running on the ESP32 2432S024Rv3)
This is a basic device manager for all kinds of devices connected to the Tuya cloud via e.g. the Smart Life app. I use it to display the status for my door, window, socket and temperature sensors.
Developed with Visual Studio Code and PlatformIO
Warning
Still very much work-in-progress! There is no error handling for now.
Credits go to Rzeldent's esp32-smartdisplay without I would never have been able to set this up so quickly.
- Fetches all devices from the Tuya cloud connected to the clientID
- For each device ID, fetch the current device status
- If the device type matches one of the declarations in the
ui_globals.cpp
, parse and display the infos- Don't forget to also add new devices types to the parsing function updateDevicesDisplay() in
ui.cpp
- Don't forget to also add new devices types to the parsing function updateDevicesDisplay() in
- A clientID and clientSecret are needed -> they are obtainable in the Tuya cloud at cloud->project->Overview (https://platform.tuya.com/cloud/basic)
- (The account might need to be set as a dev account, but I forgot where exactly this can be set ;))
- Clone this repository (all sub modules will automatically be cloned by platformIO)
- Copy
config_template.h
toconfig.h
- Edit
config.h
and fill in your personal information:- WiFi SSID and password
- Tuya client ID and secret
- Set your Arduino board in the platformio.ini
- Compile and upload the project to your Arduino board
- Happy coding!
Note: config.h
is ignored by git to keep your personal information private.
Note #2: The method updateTimeOffset() in main.cpp
only works for CET, it needs to be adjusted for other timezones for the clock and api calls to work correctly.
v0.1: first public version, 01.08.24
The Tuya docs are really extensive and well done (https://developer.tuya.com/en/docs/iot/device-intelligentize-in-5-minutes?id=K914joxbogkm6)
- LVGL:
- ESP32 smartdisplay demo by Rzeldent: https://github.com/rzeldent/esp32-smartdisplay-demo
- LVGL examples: https://docs.lvgl.io/master/examples.html
- Tuya:
- API explorer: https://eu.platform.tuya.com/cloud/explorer
- Get access token: https://developer.tuya.com/en/docs/cloud/6c1636a9bd?id=Ka7kjumkoa53v
- Sign request for cloud auth: https://developer.tuya.com/en/docs/iot/new-singnature?id=Kbw0q34cs2e5g
- Verify signature result: https://developer.tuya.com/en/docs/iot/check-postman-sign?id=Kavfn3820sxg4
- API calls samples: https://developer.tuya.com/en/docs/iot/set-up-postman-environment?id=Ka7o385w1svns
- Limits on api request frequency: https://developer.tuya.com/en/docs/iot/frequency-control?id=Kcojz2r2dg1f6
- GET postman env for api calls: https://developer.tuya.com/en/docs/iot/set-up-postman-environment?id=Ka7o385w1svns