Flashing the SMS4IOT Firmware To flash firmware onto new device: . ~/esp32/esp-idf/export.sh (Assuming thats where you put your ESP32 idf) esptool.py --chip esp32c5 -p /dev/ttyACM0 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x2000 bootloader.bin 0x20000 dcisms4iot.bin 0x8000 partition-table.bin 0xf000 ota_data_initial.bin You may have to change the UART port (eg -p /dev/ttyACM0) above. This is for ESP32-C5_MINI board* ($4 on Aliexpress). Once flashed connect to the device console via "screen /dev/ttyACM0" or something similar. Do a "stat" to see whats going on. You shall see log messages every second or so showing the device trying to: 1. connect to some wifi hotspot 2. autoconfiguring itself with a. demo device id (e.g. "10001003") b. a key to access the sms4iot gateway, and c. a on device only private key for secure end-to-end communication If the device is successful in finding a hotspot, you should start to see the correct date and time (UTC) in some of the messages. 3. Enter "qr" on the console and snap a picture of the QR code, then enter "qr" again to re-enable log messages. Make sure your console screen is large enough to accomodate the full QR code. This will later be used to add the device to Home Assistant. If the device was not able to find a suitable hotspot, the device will continue rescanning for hotspots and trying. I found this works in most urban environments (cafes, fast food, hotels, airports, resturants, stores, public buildings, parks, etc...) Home Assistant Integration (HA) - Linux 1. Copy directory sms4iot to your HA config/custom_components/ directory and restart HA. 2. Start the sms4iot daemon "s4igw" running, e.g., "cd config/custom_components/sms4iot" then "./s4igw". This program will periodically exchange payloads encrypted by/for your devices with global sms4iot gateways. If need be, "cc s4igw.c -o s4igw" to rebuild the daemon for your Linux version. Start s4igw by running ./s4igwup shell script. 3. Go to HA Settings and Devices and add the SMS4IoT integration. This will prompt you to scan the QR generated above. 4. Your new device, identified by device id number (e.g. "10001003"), should show up. After a minute or two, data from you device should show up in HA. 5. Thats it. You device can be in a cafe on the other side of the world or in your house. *Configured GPIOs for esp32-c5_mini ESP32-C5HF4 (no psram, 4gb flash) SDA 10 // will scan for AHT2X temp/hum device if there SCL 8 RELAY 5 LED 23 // on board RGBLED(WS2818) 6 // "rgb" command from console will control rgbled BOOT 28 // on board ADC 3 // can be 3.3V divider w/ 2x470K LIGHTSENSOR 9 // GT36516 CDS in parralel w/ 0.1uf to GND