Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 16

Table of Contents

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


GPIODetails
4White LED
5Red LED
12Relay
13Button 
14Sensor

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-####

...

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:

3 Way Setup

From the Configuration → Configure Other screen, input the template and friendly name:

Template: 

{"NAME":"Treatlife 3-Way","GPIO":[0,0,0,0,21,158,0,0,22,18,9,0,0],"FLAG":0,"BASE":18}


Image Added


You should end up with a configuration that looks like:


Image Added




2 Way Setup

> backlog module 18;gpio4 2152;gpio5 570;gpio12 3029;gpio13 1817;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:

switchmode 1


Image AddedImage Removed

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:

Image RemovedImage Added


Homebridge Config File

3-Way Setup: 

Code Block
		        {
            "accessory": "mqttthing",
            "type": "lightbulb",
            "name": "dimmer2garage-light",
            "url": "http://192.168.X1.X50:1883",
            "username": "homebridge",
            "password": "pass",
            "topics":
            {
                "getOn":                "stat/dimmer2garage-light/POWERPOWER1",
                "setOn":                "cmnd/dimmer2/POWER",
                "getBrightness":        {
                                          "topic": "statcmnd/dimmer2garage-light/RESULTPOWER2",
                                          "apply": "return JSON.parse(message).Dimmer'toggle';"
                                        },
                "setBrightness":        "cmnd/dimmer2/Dimmer"
            },
            "onValue": "ON",
            "offValue": "OFF",
            "startPub":
            {
                "cmnd/dimmer2garage-light/POWERPOWER1": "",
                "cmnd/dimmer2/Dimmer": ""
 },
           },
		    "confirmationPeriodms": 1000
        },

Out of Sync

Sometimes the switch may be out of sync with what it reports to homebridge. When you click Toggle 2, the Toggle1 should reflect the current state of the light. If this is not the case, click the Toggle 1 button.

Image Added

Reference