SolarEnergy/docs/SETUP_DEV.md
Pierre HUBERT 16b03f0a05
All checks were successful
continuous-integration/drone/push Build is passing
Add documentation to setup dev env
2024-10-14 23:07:06 +02:00

2.5 KiB

Setup development environment

Backend

To build the backend, you will need to install:

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:

Custom consumption

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:

ESP mapping

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