[ST Edge] •• Tasmota Edge •• for Sonoff, Tuya & many other ESP WiFi & HTTP devices - over 2000 Tasmota supported devices

I hope to release button remote next month.

That would be great! I have a lot of remote buttons.

Hi Hongtat,

I have tried both of the following templates, one of which you referenced and the other that I found on another thread somewhere:

{"NAME":"DS03 Fan/Light","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}

{"NAME":"DS03 Fan/Light","GPIO":[0,107,0,108,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}

Here is the output of the command you requested.

{"Status":{"Module":0,"DeviceName":"TasmotaTreatLifeDS03","FriendlyName":["TasPatioLightFan",""],"Topic":"tasmota_8BC62C","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0},"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Software/System restart","Uptime":"7T12:14:23","StartupUTC":"2022-09-11T04:36:12","Sleep":50,"CfgHolder":4617,"BootCount":32,"BCResetTime":"2021-04-25T15:19:44","SaveCount":2214,"SaveAddress":"F6000"},"StatusFWR":{"Version":"12.1.1(tasmota)","BuildDateTime":"2022-08-25T11:33:55","Boot":31,"Core":"2_7_4_9","SDK":"2.2.2-dev(38a443e)","CpuFrequency":80,"Hardware":"ESP8266EX","CR":"417/699"},"StatusLOG":{"SerialLog":0,"WebLog":0,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["tayfam",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C80001000600003C5A0A002800000000","00000280","0000E000","00004000","00000000"]},"StatusMEM":{"ProgramSize":624,"Free":376,"Heap":24,"ProgramFlashSize":1024,"FlashSize":2048,"FlashChipId":"154068","FlashFrequency":40,"FlashMode":3,"Features":["00000809","8F9AC787","04368001","000000CF","010013C0","C000F981","00004004","00001000","54000020","00000000"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37,45,62","Sensors":"1,2,3,4,5,6"},"StatusNET":{"Hostname":"tasmota-8BC62C-1580","IPAddress":"192.168.0.131","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.0.200","DNSServer2":"0.0.0.0","Mac":"84:CC:A8:8B:C6:2C","Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":17.0},"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_8BC62C","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4},"StatusTIM":{"UTC":"2022-09-18T16:50:35","Local":"2022-09-18T17:50:35","StartDST":"2022-03-27T02:00:00","EndDST":"2022-10-30T03:00:00","Timezone":"+01:00","Sunrise":"06:31","Sunset":"18:57"},"StatusSNS":{"Time":"2022-09-18T17:50:35"},"StatusSTS":{"Time":"2022-09-18T17:50:35","Uptime":"7T12:14:23","UptimeSec":648863,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"POWER1":"ON","POWER2":"OFF","Dimmer":38,"Fade":"OFF","Speed":1,"LedTable":"OFF","Wifi":{"AP":1,"SSId":"tayfam","BSSId":"3C:7C:3F:6A:12:30","Channel":7,"Mode":"11n","RSSI":100,"Signal":-42,"LinkCount":4,"Downtime":"0T00:29:03"}}}

Thanks for looking into it!!

Hi, thanks for creating this! I’m also trying to get a Treatlife Light + Fan switch working (DS03). I’m new to Tasmota (just heard of it today) but I bought a DS03 and desoldered its WBS3 and soldered an ESP onto it with Tasmota flashed on it. I followed the setup from here: TreatLife Light and Fan Dimmer (DS03) Configuration for Tasmota which allows me to control it from the webserver GUI. Now trying to see if I can get it to work with your edge driver.

I initially tried adding it as a “Fan” device and adding a “Light” from the the fan device. Turning on/off the fan and controlling its speed resulted in errors like this:

05:03:48.459 CMD: Grp 0, Cmd 'JSON', Idx 1, Len 14, Pld -99, Data '{"FanSpeed":0}'
05:03:48.474 SRC: Backlog
05:03:48.476 CMD: Grp 0, Cmd 'FANSPEED', Idx 1, Len 1, Pld 0, Data '0'
05:03:48.482 RSL: RESULT = {"Command":"Unknown"}

I guess this makes sense since the template page says the command should be TuyaSend4 3,1;Power1 ON (for low fan speed).

Going over to the “Light” device that was created off of the fan, clicking the on/off seems to turn the fan relay on and off.

05:00:27.971 CMD: Grp 0, Cmd 'JSON', Idx 1, Len 14, Pld -99, Data '{"POWER1":"1"}'
05:00:27.988 SRC: Backlog
05:00:27.990 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 1, Data '1'

I then tried deleting those devices and adding a “Dimmer” device. This acts a lot like the light device, On/Off turns the fan relay on/off and the dimmer control does not seem to do anything.

Let me know if you need any more info or if you need me to test anything. I’ll be buying a few more of these devices, it would be awesome to get them to work with your edge driver.

Is anyone else bothered by this ? One of the reasons I LIKE Tasmota is because it’s open source… and it makes me slightly nervous to run closed-source 3rd party code on my hub without having insight into exactly what it’s doing. Is there a way to get a sense of security here @hongtat ?

There is a discussion on the security about community provided edge drivers -
General security question about community provided edge drivers - #13 by posborne

The legacy Tasmota (Connect) groovy code is available on github, if you are interested.

Yes, and in that discussion transparency is encouraged and limits to the security model are made explicit, especially in the case of lan capable edge drivers like this one. For obvious reasons the groovy DTH is rather irrelevant from a security perspective, as there’s no guarantee that the Lua implementation is at all the same.

Is the main reason for closed source to force people to support the development? If so, would there be some number of donators or amount of money that you would consider being sufficient to open the source up, or perhaps open it up at a certain development point for basic devices and donors could get additional improvements?

I believe this is not much difference from small publisher’s apps in Google, Apple, Windows, or 3rd-party App store, etc. - we won’t be able to see the code if they are closed-source.

There’s also no guarantee that the open-source Lua code and the installed via channel are the same.

Over the past 2 years for Tasmota (Connect), there hasn’t been much/any code pull request improvements.

“Force” people to support the development is a rather strong word, it is free for use up to 5 devices.
It was mentioned somewhere that most SmartThings users have less than 10 devices (iirc).

A lot of effort have been made to maintain, support and improve the driver (since Groovy to Lua). I’d prefer to keep the code as closed-source.

That’s understandable but too bad . I was hoping for some option where if I were to pay enough , or jointly if people were to pay enough , we would be able to inspect the source . The iOS ecosystem (which I use) has significantly stronger protections around permissions than smartthings .

Thanks for linking the old Groovy driver. I realized maybe I could use it for now. I was able to hack it up to work with a DS03 (with fan speed control and light dimmer control), hopefully the Edge driver will be able to support it soon but in the meantime this works

I agree. Totally understand why @hongtat is charging, but I prefer open source. I’ll be writing my own. I want to use a MQTT bridge anyways.

I have a NodeMCU which was previously used with Konnected (alarm panel), it has 5 inputs (switches) and 2 outputs (relays). I loaded the firmware and have it configured, the console shows the inputs working but I can’t figure out how to get the multiple devices in Smartthings. I installed the driver and can create a device, set the IP address for the board and it responds to the first input but how do I get the other inputs and output controls? (or perhaps Tasmota isn’t the solution)

I’m not savvy with MQTT , but I’d be happy to try something out if it works with tasmota and smartthings without having to setup my own middleware server ?

You’ll need middleware to be a bridge to MQTT.

I guess what I’m asking here is do you plan to write your own open source driver alternative to this one , which does not require the middleware ?

No, I will be writing one that requires middleware.

Does adding additional switches work for you?

As I don’t have a DS03, can you let me know the change you made and I can add it in. Thanks.

Sure, I started with the Sonoff iFan as a base. I then changed the Rule1 1 to this:

     parent.callTasmota(this, "Backlog Rule1 on TuyaReceived#Data=55AA03070005030400010016 do WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"FanSpeed\":\"1\"}} endon on TuyaReceived#Data=55AA03070005030400010117 do WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"FanSpeed\":\"2\"}} endon on TuyaReceived#Data=55AA03070005030400010218 do WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"FanSpeed\":\"3\"}} endon on TuyaReceived#Data=55AA03070005030400010319 do WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"FanSpeed\":\"4\"}} endon ON Power2#state DO WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"POWER2\":\"%value%\"}} ENDON ON Power1#state DO WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"POWER1\":\"%value%\"}} ENDON ON Wifi#Connected DO WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"cb\":\"Status 11\"} ENDON ON Dimmer#state DO WebSend ["+device.hub.getDataValue("localIP") + ":" + device.hub.getDataValue("localSrvPortTCP")+"] /?json={\"StatusSTS\":{\"Dimmer\":\"%value%\"}} ENDON;Rule1 1")

The DS03 has 4 FanSpeeds instead of 3 so I changed the FanSpeed code to allow for 4.

For setting the fan speed I changed the FanSpeed command to this:

parent.callTasmota(this, "TuyaSend4 3,0") //This is FanSpeed Low
parent.callTasmota(this, "TuyaSend4 3,1") //This is FanSpeed Medium
parent.callTasmota(this, "TuyaSend4 3,2") //This is FanSpeed High
parent.callTasmota(this, "TuyaSend4 3,3") //This is FanSpeedMax

Since DS03 has separate speed and on/off control for the fan, changing the fan speed does not turn it on if the fan is off (I want/will be updating the Rule so it just turns itself on when the speed is changed). Power on/off for the fan is Power1 so I used:

 parent.callTasmota(this, "POWER1 1") //Power on the fan
 parent.callTasmota(this, "POWER1 0") //Power off the fan

Add a parse event for the fan powering on:

         def fanPower = (json?.StatusSTS?.POWER1 != null) ? (json?.StatusSTS?.POWER1) : ((json?.POWER1 != null) ? json?.POWER1 : null)
         if (fanPower != null) {
            if (fanPower in ["ON", "1"]) {
                events << sendEvent(name: "switch", value: "on")
                log.debug "Fan switch: 'on'"
             } else if (fanPower in ["OFF", "0"]) {
                events << sendEvent(name: "switch", value: "off")
                log.debug "Fan switch: 'off'"
             }
         }
 

I also changed the light since with the DS03 the light is dimmable:

To turn the light on/off it’s POWER2:

 def childOn(dni) {
     parent.callTasmota(this, "POWER2 1")
 }
 
 def childOff(dni) {
     parent.callTasmota(this, "POWER2 0")
 }

Change the parse event for the light powering on:

def power = (json?.StatusSTS?.POWER2 != null) ? (json?.StatusSTS?.POWER2) : ((json?.POWER2 != null) ? json?.POWER2 : null)

The following function was added so the child can be dimmed:

 def childSetLevel(dni, value) {
    log.debug "childSetLevel >> value: $value"
    def valueaux = value as Integer
    def level = Math.max(Math.min(valueaux, 100), 0)
    parent.callTasmota(this, "DIMMER " + level)
}

And this parse event was added to capture the dimmer events:

        // Dimmer
        if (json?.StatusSTS?.Dimmer != null) {
            def level = json?.StatusSTS?.Dimmer?.toInteger()
            if (level >= 0 && level <= 100) {
                childDevices[0]?.sendEvent(name: "level", value: level)
            }
            log.debug "Dimmer: '$level'"
        }

I’ve also forked the repo and pushed the changes here so it’s easy for you to see this diff: Hack up iSonoff Fan driver to work for DS03 · SeanReg/tasmota-connect-ds03@b894ce6 · GitHub

1 Like

I changed the configuration to 2 switches with 2 corresponding relays and used 2 gang, then it works in the ST app.

When configured correctly with 5 inputs and 2 outputs (not related, so detached using setoption114) then the switches do nothing in the ST app and I haven’t figured out how I would control the outputs. I tried setting to buzzer or relay but how do I add these to the app?