/rainmaker-rs

Cross-platform Rust implementation of ESP RainMaker

Primary LanguageRustApache License 2.0Apache-2.0

Rust Implementation of ESP Rainmaker

A cross-platform implementation of ESP Rainmaker for ESP32 products and Linux using Rust.

Build Prerequisites

  • Follow the Prerequisites section in the esp-idf-template crate.
  • Install Protobuf compiler on your system.
  • Install ESP-Rainmaker app on your phone.

Get rainmaker-rs

Please clone this repository using the below command:

  git clone https://github.com/shreyash-b/rainmaker-rs.git

Running on ESP devices

  1. Erase flash contents:
espflash erase-flash
  1. Use rainmaker cli to perform manual claiming on ESP devices
./rainmaker.py claim /dev/ttyUSB0 --addr 0x3FA000
  1. Navigate to rainmaker-rs directory
cd rainmaker-rs
  1. Build the project
cargo build
  1. Run
cargo run --target <mcu-target>
MCU Target
ESP32 xtensa-esp32-espidf
ESP32-S2 xtensa-esp32-espidf
ESP32-S3 xtensa-esp32-espidf
ESP32-C2 riscv32imc-esp-espidf
ESP32-C3 riscv32imc-esp-espidf
ESP32-C6 riscv32imc-esp-espidf
  1. Monitor
espflash monitor

Running on Linux

  1. Create directories for storing persistent data
mkdir -p ~/.config/rmaker/fctry
mkdir -p ~/.config/rmaker/nvs
  1. Fetch claim data using rainmaker cli
./rainmaker.py login
./rainmaker.py claim --mac <MAC addr> /dev/null 
  1. Run
cargo run --target x86_64-unknown-linux-gnu
OR
cargo run_linux

Once the example is running, open the rainmaker mobile application and follow on-screen instructions for adding device

When running for the first time, you'll need to set RMAKER_CLAIMDATA_PATH environment variable to the folder containing your claimdata(mentioned in before running section)


Note

  • When running on ESP32 for first time, on initial boot it will start wifi provisioning and user node mapping.
  • After performing wifi provisioning using Rainmaker Android application restart the ESP32 for normal functioning