Flashing


Using Tasmotizer

pip3 install --upgrade pip wheel
pip3 install tasmotizer
tasmotizer.py

Setup

From Console on Tasmota UI


Issue the following commands:

module 54
backlog so97 1 ; tuyamcu 11,1 ; tuyamcu 12,9 ; tuyamcu 21,10
backlog ledtable 0 ; dimmerrange 100,1000 ; so59 1 ; so68 0


Add the following rule, this should be all on ONE line. 

This rule will not turn the fan on when the fan speed is changed.

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 the rule with the following

Rule1 1


Homebridge Config

Light

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


Fan

{
            "accessory": "mqttthing",
            "type": "fan",
            "name": "John's Fan",
            "url": "http://192.168.1.60:1883",
            "username": "homebridge",
            "password": "pass",
            "topics": {
                "getOn": "stat/johnlight/POWER1",
                "setOn": "cmnd/johnlight/POWER1",
                "getRotationSpeed": {
                    "topic": "stat/johnlight/speed",
                    "apply": "return( ( message == '3,0' ) ? 25 : null || ( message == '3,1' ) ? 50  : null || ( message == '3,2' ) ? 75  : null || ( message == '3,3' ) ? 100  : null );"
                },
                "setRotationSpeed": {
                    "topic": "cmnd/johnlight/tuyasend4",
                    "apply": "return( ( message <= 25 ) ? '3,0' : null || ( message > 25 && message <= 50 ) ? '3,1'  : null || ( message > 50 && message <= 75 ) ? '3,2'  : null || ( message > 75 && message <= 100 ) ? '3,3'  : null );"
                }
            },
            "onValue": "ON",
            "offValue": "OFF",
            "startPub": {
                "cmnd/johnlight/POWER1": "",
                "cmnd/johnlight/speed": ""
            },
            "confirmationPeriodms": 1000
}


Investigating Tuya Messages

> weblog 4


Manipulating the fan

Console Output

02:06:52 {"TuyaReceived":{"Data":"55AA03070005030400010218","Cmnd":7,"CmndData":"0304000102","DpType4Id3":2,"3":{"DpId":3,"DpIdType":4,"DpIdData":"02"}}}
02:06:52 RUL: TUYARECEIVED#DATA=55AA03070005030400010218 performs "publish2 stat/johnlight/speed 3,2"
02:06:52 SRC: Rule
02:06:52 CMD: Group 0, Index 2, Command "PUBLISH", Data "stat/johnlight/speed 3,2"
02:06:52 MQT: stat/johnlight/speed = 3,2 (retained)

Data: 55AA03070005030400010218

CmndData: 0304000102

Speed: 2


Rule: 

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


Manipulating light brightness

1:49:08 {"TuyaReceived":{"Data":"55AA030700080A020004000003183C","Cmnd":7,"CmndData":"0A02000400000318","DpType2Id10":792,"10":{"DpId":10,"DpIdType":2,"DpIdData":"00000318"}}}
01:49:08 TYA: fnId=21 is set for dpId=10
01:49:08 TYA: RX value 792 from dpId 10 
01:49:09 {"TuyaReceived":{"Data":"55AA030700080A020004000002D2F5","Cmnd":7,"CmndData":"0A020004000002D2","DpType2Id10":722,"10":{"DpId":10,"DpIdType":2,"DpIdData":"000002D2"}}}
01:49:09 TYA: fnId=21 is set for dpId=10
01:49:09 TYA: RX value 722 from dpId 10 


Observations:

Data: 55AA030700080  A02000400000318  3C

CmdData: A02000400000318

318hex = 792

Checksum: 3C


Rule:

<Doesn't WORK>

Rule2 on TuyaReceived#DpId=10 do publish2 stat/johnlight/bb DpIdData endon
Rule2 1                          


Even this doesn't work! Don't know why.

Rule2 on TuyaReceived#Data=5AA030700080A020004000000 do publish2 stat/%topic%/bb 1,1 endon
Rule2 1


Issues

Flickering Light

I think this issue is a result of the triac not having proper adhesion to the heat sink. The triac is simply pushed up against the heatsink. It has a foam pad that allows heat transfer from the triac to the heatsink.



Could we do something better here?


Triac - BTA316-600ET

https://www.digikey.ca/en/products/detail/ween-semiconductors/BTA316-600ET-127/2530340

Datasheet:

https://www.ween-semi.com/sites/default/files/2018-10/bta316-600et.pdf

References

ReferenceURL
The Tasmota Fan Controller I've been waiting for...https://www.digiblur.com/2020/07/the-tasmota-fan-controller-ive-been.html
Blakadder's DS03https://templates.blakadder.com/treatlife_DS03.html
Combo Speed Fan Controller/Dimmer with Tasmota - How to Flash Shelly devices with NO wires!https://www.youtube.com/watch?v=o813Kjw76_I
Tasmotizerhttps://github.com/tasmota/tasmotizer
  • No labels