Overview

We will detail the steps required to flash the open source Tasmota firmware on a Treatlife 3 way switch and configure it to work with Homebridge.

Hardware


Install Tuya Convert on a Raspberry Pi

See https://github.com/ct-Open-Source/tuya-convert

Flash Device

Detailed instructions can be found:  https://github.com/ct-Open-Source/tuya-convert


You will need to hold down the button to get this switch to flash.

> ./start_flash.sh 

Configuring Switch

Configuring WIFI

Connect to the flashed device by looking for it's SSID - tasmota-####

Browse to http://192.168.4.1/

Configure the SSID and password.

The dimmer will reboot and connect to your wifi network. Check your router to find out it's IP address and connect to it via your browser.

Set the GPIOs

Issue the following from the console:

backlog module 18;gpio4 21;gpio5 57;gpio12 30;gpio13 18;gpio14 9;switchtopic 0;switchmode1 0;buttontopic 0;rule1 on event#ON do power2 TOGGLE endon;rule1 1;rule2 on event#OFF do power2 TOGGLE endon;rule2 1


Should result in the following:



Homebridge Config

For integration with Homebridge, we are going to use the mqttthing plugin and run all of the commands through an mqtt server.


Tasmota Setup:


Homebridge Config File: 

		{
            "accessory": "mqttthing",
            "type": "lightbulb",
            "name": "dimmer2",
            "url": "http://192.168.X.X:1883",
            "username": "homebridge",
            "password": "pass",
            "topics":
            {
                "getOn":                "stat/dimmer2/POWER",
                "setOn":                "cmnd/dimmer2/POWER",
                "getBrightness":        {
                                          "topic": "stat/dimmer2/RESULT",
                                          "apply": "return JSON.parse(message).Dimmer;"
                                        },
                "setBrightness":        "cmnd/dimmer2/Dimmer"
            },
            "onValue": "ON",
            "offValue": "OFF",
            "startPub":
            {
                "cmnd/dimmer2/POWER": "",
                "cmnd/dimmer2/Dimmer": ""
            },
		    "confirmationPeriodms": 1000
        }

Reference

ReferenceURL
Tuya Converthttps://github.com/ct-Open-Source/tuya-convert
*Lasted Docs on Tuya MCU for Tasmotahttps://tasmota.github.io/docs/#/TuyaMCU?id=tuyamcu-command
*How to setup a Tuya MCU Dimmer (Video)https://www.youtube.com/embed/_3WW4NVYHrU
* List of supported Tuya Convert deviceshttps://github.com/ct-Open-Source/tuya-convert/wiki/Compatible-devices-(HTTP-firmware)
* Video showing how to configure Treatlife 3wayhttps://www.youtube.com/watch?v=9LIaDN7Nx2E
Tasmota Templateshttps://templates.blakadder.com/switch.html
Tuya MCU Based Dimmers and Switcheshttps://github.com/arendst/Tasmota/wiki/MCU-Based-Tuya-Dimmers-and-Switches
Custom Dimmer Tasmota Firmware https://github.com/digiblur/TuyaDimmer-Tasmota
CE Smart Home Wifi Smart Dimmer Light Switch (TYWE1S) Model WF500Dhttps://github.com/arendst/Tasmota/issues/4003
CE Dimmer Manualhttps://fccid.io/ZZH-WF500D/User-Manual/Users-Manual-3846958#download
Tasmota - Tuya Converthttps://tasmota.github.io/docs/#/Tuya-Convert
Tasmota - Other Supported Deviceshttps://github.com/arendst/Tasmota/wiki/Other-devices
Video - Setup