An alternative firmware for the (6€) itead Sonoff TH10/TH16. This firmware supports the Apple HomeKit framework and the QR-Code pairing for it (PoC).
Prerequisites for building OTA-Update-Images is the presence of openssl and the esptool2 on your system.
-
Install esp-open-sdk, build it with
make toolchain esptool libhal STANDALONE=n
, then edit your PATH and add the generated toolchain bin directory. The path will be something like /$HOME/path/to/esp-open-sdk/xtensa-lx106-elf/bin. -
Checkout esp-open-rtos and set SDK_PATH environment variable pointing to it. E.g. export SDK_PATH=$HOME/espressif/esp-open-rtos
-
Initialize and sync all submodules (recursively):
git submodule update --init --recursive
- Install required python modules for QR-Code creation:
pip install pyqrcode pypng
- Create a new QR-Code for HomeKit pairing as every device on your network needs a unique setup id.:
make homekitSettings
Print the QR-code ('qrcode.png') and stick it on the device (or save it on a safe place for documentation). 6. Set your environment variables to match your needs:
- Set ESPPORT environment variable pointing to USB device your ESP8266 is attached
to (assuming your device is at /dev/tty.SLAB_USBtoUART):
export ESPPORT=/dev/tty.SLAB_USBtoUART
- Set your OTA-Update server environment variables.
-
Set the server
export OTA_UPDATE_SERVER="192.168.1.2"
-
Set the port
export OTA_UPDATE_PORT="8080"
-
Set the path on the server to the firmware files:
export OTA_UPDATE_PATH="/ota/sonoff-th"
-
Name your firmware files (defaults to "latest"):
export OTA_UPDATE_FIRMWARE_NAME="latest"
-
- To prevent any effects from previous firmware, it is highly recommended to erase flash:
or, if you didn't set the ESPPORT environment variable:
make erase_flash
make erase_flash ESPPORT=/dev/tty.SLAB_USBtoUART
- Flash the firmware on the Sonoff TH10/TH16
make -j4 test
or
make -j4 flash
make monitor
Again: Prerequisites for building OTA-Update-Images is the presence of openssl and the esptool2 on your system.
If you just (later) want to compile the OTA firmware images just enter
make -j4 ota-images
and copy the compiled, linked and hashed firmware images to your update server (using the path you have chosen at compilation time).
You'll find the files in the firmware/ota directory. Copy ALL files to your webserver directory accessible via your chosen update server path.
To initiate an OTA update of the device, just long-press the device button (4 secs and on) on an already flashed device.