Skip to content

Open source firmware for the TreatLife DS0X dimmer switches for native HomeKit use.

License

Notifications You must be signed in to change notification settings

paullj1/TreatLife-HomeKit

Repository files navigation

TreatLife HomeKit

Open source firmware with native HomeKit support, and OTA upgrades for:

Release Binaries

Github All Releases Latest

Flashing

Using esptool from Espressif

  1. Setup esptool
  2. Acquire a USB to Serial adapter (I used this one)
  3. Solder the 3.3v (VCC), GND, TXD, and RXD onto the chip:
  1. Connect GPIO0 to ground when applying power to the chip to enter flash mode
  • I did this by soldering a wire to the back of the USB to serial adapter's GND pin, and then touching it to GPIO0 when plugging in USB adapter
  1. Run esptool (where /dev/tty.usbserial-XXXX is your USB to serial adapter, and DS02S.bin is the desired firmware image):
esptool.py -p /dev/tty.usbserial-XXXX -b 115200 write_flash -e 0x0 DS02S.bin
  1. Reboot device by unplugging USB power, and then plugging it back in

Setup

  1. When device boots, it will enter config mode
  2. Connect to WiFi access point the device exposes (ESP-XXXXXX) where XXXXXX is the last 6 bytes of the devices MAC address
  3. Configure your WiFi SSID/password
  4. Go to the home app on your iPhone/iPad and press the "+" button and select "Add Accessory"
  5. Press "I Don't Have a Code or Cannot Scan"
  6. Your device should appear on this screen, select it, and enter the setup code "030-52-021" (or use QR code above)
  7. Device should pair

Config Mode

  • To enter config mode to change your SSID, or update the firmware, press and hold the light on/off button for at least five seconds, then browse to the IP address of the device. To get the IP, you can look at your ARP cache for the MAC address which matches the devices serial number.

Notes

  • If upgrading from tasmota, you'll need to use the gzip'd binary in the release
  • This firmware is built to utilize the ESP8266EX chip in the SmartLife devices which has 2mb of flash
    • If upgrading from an older version, DO NOT use the gzip'd binary, the full bin should work

Building

arduino-cli

# To build a specific device, cd into its dir, then:
# In any of the device directories (DS01C, DS02S, DS03, etc...)
make requirements
make compile
# Resulting binary will be DSXXX.bin; use esptool, "make upload", or Arduino to flash

# To build all at once from top level directory (resulting bins will be in 'release' dir):
make

Arduino IDE

Use the following settings, and install the required dependencies:

Dependencies (libraries you'll need to install in Arduino IDE):

Credits

  • Adapted Tuya MCU driver code from Tasmota