Skip to content

romasku/tuya-zigbee-switch

Repository files navigation

Custom firmware for Tuya switch

A custom firmware for Tuya telink based switch module. Code is based on pvvx's ZigbeeTLc firmware, huge thanks!

Supported devices

Note that rebranded version may have different internals and may not work. "Zigbee Manufacturer" is more reliable identifier of device.

  • Tuya WHD02 is supported. Tested only for _TZ3000_skueekg3.
  • TS0001 is supported. Should work for _TZ3000_tqlv4ug4.
  • TS0002 is supported. Should work for _TZ3000_zmy4lslw.
  • TS0011 is supported.
  • TS0012 is supported.

If you device is not supported, but it is some Tuya switch module, please check the porting guide.

Why?

The main driver for this project was the following factory firmware bug: if one button is pressed, the device ignores clicks to other buttons for ~0.5 seconds. The most frustrating consequence is that pressing both buttons at the same time turns only one relay on.

Features

  • Detached mode, e.g. switch doesn't trigger relay but only generates events via Zigbee
  • Long press for momentary switches
  • Router mode (TS0012 is no neutral switch so factory firmware works as end device)
  • Super fast reaction time (compared to the factory firmware)
  • 5 quick presses to reset the device

Building

Only on linux:

make install
make

Flashing device

Firmware can be flashed via OTA. If you still use zigbee2mqtt 1.x, use this guide

To switch between End Device and Router follow this guide

To flash via wire, follow this guide

Changelog

v1.0.6

  • Add way to change device pinout on the fly, to allow easier porting of firmware

v1.0.5

  • Keep status LED on when device is connected
  • Add separate firmwares for End Device/Router
  • Improve device boot time significantly by removing unnecessary logs

v1.0.4

  • Fix bug that caused report to be sent every second

v1.0.3

  • Add support of statup behaviour: ON, OFF, TOGGLE, PREVIOUS
  • Add support of button actions: 'released', 'press', 'long_press'. This is only useful for momentary (doorbell-like) switches.

v1.0.2

  • Add way to reset the device by pressing any switch button 5 times in a row
  • Fix support for ON_OFF, OFF_ON actions

Acknowledgements