WiFi Smart Ceiling Fan Control and Dimmer Light to Tasmota

pete_c

Guru
Converting a Treatlife Smart Ceiling Fan Control and Dimmer Light to Tasmota

Hardware:

1 - Treatlife Smart Ceiling Fan Control and Dimmer Light - ~ $44.99 on Amazon
 
[sharedmedia=gallery:images:1398]
 
2 - new plastic wall plate to accomodate UPB dual toggle switch and Fan / Light control dimmer 

Carlon A420 Outlet Box Cover - ~ $5.41 on Amazon
 
[sharedmedia=gallery:images:1399]
 
Updating to Tasmota.
 
1 - at this time these devices are shipping with Tuya firmware that is blocking the current TuyaConvert exploit
2 - The switch will need to be flashed via the old school manual method
 
[sharedmedia=gallery:images:1400]
 
 
I've left the above and will continue here with a step by step including wiring and JTAGing of the WiFi switch.  
 
10th of November, 2020
 
Decided to try a JTAGing jig to update the firmware to Tasmota.  This is a solderless mechanism which allowed updating of firmware via a 3D printed jig.

Here is the TYWE3S Pogo Pin Programming Jig. Very easy to use.

hxxps://www.thingiverse.com/thing:4099748
 
18th of November, 2020
 
Finished box #1 and working on box #2.
 
Here the steps in Linux to upload the firmware.
 
Steps using ESPTool and command line in Linux. Note that flash is 2Mb in size.

1 - pip install esptool
2 - backup firmware

esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x200000 image2M.bin

3 - download current version of tasmota.bin file
hxxps://github.com/arendst/Tasmota/releases/download/v9.1.0/tasmota.bin

4 - erase flash

esptool.py --port /dev/ttyUSB0 erase_flash

5 - write flash

esptool.py --port /dev/ttyUSB0 write_flash -fs 2MB -fm dout 0x0 tasmota.bin

6 - unplug and power up board

7 - attach to Tasmota AP and configure Tasmota to your AP.
 
Had issues fitting the two switches in the box.
 
[sharedmedia=gallery:images:1401]
 
Moved some wires underneath the UPB switch.
 
Completed configuration.
 

[sharedmedia=gallery:images:1402]
 

[sharedmedia=gallery:images:1403]
 

 

 
 
 
 
Today posting a step by step relating to updating the Treatlife Smart Ceiling Fan Control and Dimmer Light using a "jig" and no soldering.   Note this is done pre installation of the switch.  
 
Hardware used:  
1 - custom made programming jig
2 - clamp or painters tape
3 - test leads
4 - TTL USB programmer   
 
1 - Turn the switch such that it faces down on the work surface.    
 
2 - remove the 4 phillips screws from the back of the switch    
 
3 - pull the back cover off.  
 
[sharedmedia=gallery:images:1409]  
 
4 - line up jig with pins
 
[sharedmedia=gallery:images:1411]
 
5 - attach test leads (RX, TX, Ground, GPIO 0 and 3.3 VDC)

[sharedmedia=gallery:images:1412]

6 - programmers used

[sharedmedia=gallery:images:1413]

7 - programmer to test leads connections

a - attach 3.3vdc lead to programmer
b - attach ground lead to programmer
c - attach RX and TX leads to programmer
d - attach GPIO 0 to ground leads for programming mode
e - plug USB stick to laptop

 [sharedmedia=gallery:images:1414]
 
Here using Linux and esptool.py ...note this is a repeat post of the above.
 
1 - read current flash and write it to a bin file named image2M.bin


/home/pete/esptool-3.0# esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x200000 image2M.bin
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e0:98:06:b3:25:0c
Uploading stub...
Running stub...
Stub running...
2097152 (100 %)
2097152 (100 %)
Read 2097152 bytes at 0x0 in 190.7 seconds (88.0 kbit/s)...
Hard resetting via RTS pin...

2 - put it back in to programming mode by unplugging USB, short gpio0 and ground, wait a second or two, unshort gpio0 and ground.
 
3 - erase flash


/home/pete/esptool-3.0# esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e0:98:06:b3:25:0c
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 1.7s
Hard resetting via RTS pin...

4 - put it back in to programming mode by unplugging USB, short gpio0 and ground, wait a second or two, unshort gpio0 and ground.
 
5 - write tasmota.bin


/home/pete/esptool-3.0# esptool.py --port /dev/ttyUSB0 write_flash -fs 2MB -fm dout 0x0 tasmota.bin
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e0:98:06:b3:25:0c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0330
Compressed 614656 bytes to 436471...
Wrote 614656 bytes (436471 compressed) at 0x00000000 in 38.5 seconds (effective 127.7 kbit/s)...
Hash of data verified.


Leaving...
Hard resetting via RTS pin...

 

6 - unplug and power up board using TTL-USB stick
 
 

 
 
 
 
Pre-installation WiFi Ceiling fan / switch Tasmota configuration.
 
Hardware:
 
1 - configured with Tasmota switch
2 - used a old computer power cord, cut the power leads off 
3 - wire nuts
 
Connect the hot (black), white (neutral) and ground (leads)

[sharedmedia=gallery:images:1415]
 
First time boot.
 
1 - scan your wireless network and connect to AP labeled tasmota_XXXXX - no password required
2 - using your browser go to IP 192.168.4.1
3 - scan your wireless network and click on SSID that you want your switch to connect to
4 - configure your switch.
 
After configuration type the following in the console.
 
module 54
 
backlog so97 1 ; tuyamcu 11,1 ; tuyamcu 12,9 ; tuyamcu 21,10
 
backlog ledtable 0 ; dimmerrange 10,1000 ; so59 1 ; so68 0
 

Add the following rule, this should be all on ONE line.
 
Rule1 on TuyaReceived#Data=55AA03070005030400010016 do publish2 stat/%topic%/speed 3,0 endon
      on TuyaReceived#Data=55AA03070005030400010117 do publish2 stat/%topic%/speed 3,1 endon
      on TuyaReceived#Data=55AA03070005030400010218 do publish2 stat/%topic%/speed 3,2 endon
      on TuyaReceived#Data=55AA03070005030400010319 do publish2 stat/%topic%/speed 3,3 endon
 
Enable Rule1
 
rule1 1
 
No we need to post doing it over Wifi.  I just setup my raspberry pi - just need to find some wire nuts to setup my test switch!
 
I have Tuya-Convert installed on my Linux laptop from a while ago.
 
Tried Tuya-Convert yesterday and a few weeks back and it does not work with Treatlife Smart Ceiling Fan Control and Dimmer Light.
 
Tuya-Convert has worked on other WiFi switches for me.
 
Per DigiBlur's website The Tasmota Fan Controller I've been waiting for...
 

Unfortunately, at this time these devices are shipping with Tuya firmware that is blocking the current TuyaConvert exploit.  The switch will need to be flashed via the old school manual method.  Don't worry, this is fairly simple.  
 
 
Yeah, Tuya is actively updating their firmware to patch the exploit that Tuya-Convert uses.  I've been installing Martin Jerry switches over the last couple of months and the first batch I bought I was able to flash 100% of them OTA using Tuya-Convert.  The second batch I bought only 25% of the switches allowed me to use Tuya-Convert.  This last batch none of the switches allowed me to use Tuya-Convert. The switch model has been the same in all the batches.
 
I quickly had to learn how to connect to the device with physical connections and a USB/serial converter.  Luckily I had already bought the converter thinking that I'd end up having to use it at some point, so I didn't have to wait to get one shipped. I like using Tasmotize (which is really just a nice GUI that uses esptool.py to flash the devices).  The ability to send a config file after flashing it is really helpful.  You can set up wifi credentials, MQTT information, and even the template using the config file so that you don't have to log into the "Tasmota-XXXX" wifi and enter your wifi credentials after flashing the device.  You simply power cycle the device after flashing (unplug and replug in the the USB converter), send the config file (which is as simple as pressing a button in Tasmotize), and restart the device.  It will come up on the desired wifi network with the template and MQTT info already programmed in.  It's a real time saver IMHO.
 
Oh no! Am I going to have to do that with all my switches?! How do I make sure I don't get the latest firmware while I am away from these switches?!
 
Can you STOP firmware?
 
pete_c said:
I have Tuya-Convert installed on my Linux laptop from a while ago.
 
Tried Tuya-Convert yesterday and a few weeks back and it does not work with Treatlife Smart Ceiling Fan Control and Dimmer Light.
 
Tuya-Convert has worked on other WiFi switches for me.
 
Per DigiBlur's website The Tasmota Fan Controller I've been waiting for...
 

Unfortunately, at this time these devices are shipping with Tuya firmware that is blocking the current TuyaConvert exploit.  The switch will need to be flashed via the old school manual method.  Don't worry, this is fairly simple.  
 
 
Can you STOP firmware?
 
If you have registered and are using the cloud app I do not think that you will be able to prevent firmware updates other than taking the switches off the internet.
 
You can speed up the updating (if you want to) a tad by disconnecting the hot lead to the switches and pulling off the esp wifi board and updating the board, testing it for Tasmota and reinstalling the board.
 
I am seeing that more and more vendors are attempting to lock you to their cloud apps.  BUT the most popular WiFi switches are those that you can update firmware too.
 
While I'm sure Tuya can probably push out a firmware update, I really doubt they would do that.  The chances of the update failing and leaving a device unresponsive is too high IMHO for them to do that.  They are obviously shipping new devices with updated firmware, but I don't think I would stress out too much about getting an OTA update pushed out from Tuya.
 
Back
Top