2.5 KiB
Setup development environment
Backend
To build the backend, you will need to install:
- Rust: https://www.rust-lang.org/
- An IDE with Rust support. I would definitly recommend RustRover (the tool from IntelliJ).
Check if your environment is working using the following command:
cargo fmt && cargo clippy && cargo run -- --help
For development, the following flags might prove being useful:
--unsecure-disable-login
: Disable authentication on all web API endpoints--hostname
: Change public server hostname, if you want to expose your test instance to network device, such as an ESP32
Custom consumption
Same requirements as for the backend. This tool spawns a gui that allows to set arbitrary consumption values:
To use it, first launch this tool:
cd custom_consumption
cargo run
Set a custom value to force file creation (in the UI).
Then launch central backend (in another terminal):
cd central_backend
cargo fmt && cargo clippy && RUST_LOG=debug cargo run -- file
Central frontend
The frontend has been built using NodeJS, Vite and MUI.
Launch it using this command:
cd central_frontend
npm run dev
Python device
This component has been built using ... Python. Waw!
You will need to install this dependency, first:
apt install python3-jwt
Run the client:
cd python_device
python3 -m src.main
# Get CLI help
python3 -m src.main --help
Reformat code:
black src/*.py
ESP32 device
The ESP32 device is in reality a Wt32-Eth01 device. Use the following mapping to setup dev env:
You can use a CP2102 to flash the ESP32.
I recommend to use VSCode with the following extensions:
To build the project, use this command (in an ESP-IDF terminal):
idf.py build
To flash the ESP32, use this one:
idf.py flash
To capture logs from device, use either cu
or the following command:
idf.py monitor