Jump to content


Photo
- - - - -

Gosund WiFi dimmer replacing firmware


  • Please log in to reply
9 replies to this topic

#1 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 01 July 2020 - 07:32 AM

Testing here a pair of Gosund WiFi dimmer in wall switches.  Removed the cloud based OS and installed control via MQTT.  The prices are very good at this time for these switches.  Build looks OK.

 

This is my first time checking out one of these devices.  

 

Initially was going to JTAB the new firmware and could not.  Read that I have to remove one ZIF cable here for the JTAG.  Went with an OTA firmware update.  Worked well for me.  It gives you a choice of using an Espurna or Tasmota core base firmware and no soldering required or even a take apart.

 

Did this on my linux laptop.

  1. git clone hxxps://github.com/ct-Open-Source/tuya-convert
  2. cd tuya-convert
  3. ./install_prereq.sh
  4. ./start_flash.sh

Read some more and found that the Gosund dimmer switch is not the same as a Tuya dimmer switch over here ==> hxxps://templates.blakadder.com

The switch purchased is known as a Gosund SW2 dimmer.

All dimming and on/off functionality is controlled by an MCU that does not follow the Tuya protocol. Dimming and on/off can be set by Tasmota using simple serial commands. Reading local dimming when set by the capacitive touch panel requires a Script-enabled build and the script below to process serial status codes sent by the dimmer MCU.

So I installed the template and base 18 configuration.

{"NAME":"Gosund Dimmer","GPIO":[255,148,255,149,17,0,255,255,56,158,37,255,255],"FLAG":0,"BASE":18}

 

ooking at the console see the following:

13:25:33 RSL: tele/tasmota_C28A11/STATE = {"Time":"2020-06-30T13:25:33","Uptime":"0T00:05:22","UptimeSec":322,"Heap":26 ,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount ":0 ,"POWER":"OFF","Dimmer":27,"Fade":"OFF","Speed":1,"LedTab le" :"ON","Wifi":{"AP":1,"SSId":"ICS-ESPurna","BSSId":"E0:10:7F:XX:XX:XX","Channel":11,"RSSI":94, "Signal":-53,"LinkCount":1,"Downtime":"0T00:00:06"}}
13:27:39 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON"}
13:27:39 RSL: stat/tasmota_C28A11/POWER = ON
13:27:44 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"OFF"}
13:27:44 RSL: stat/tasmota_C28A11/POWER = OFF
13:28:18 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON"}
13:28:18 RSL: stat/tasmota_C28A11/POWER = ON
13:28:21 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON","Dimmer":84}
13:29:08 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON","Dimmer":25}
13:29:10 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON","Dimmer":26}
13:29:13 RSL: stat/tasmota_C28A11/RESULT = {"POWER":"ON","Dimmer":11}

 

GosundTasmota
 
gsdimmer

 

 



#2 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 02 July 2020 - 08:53 AM

02, July 2020

 

Was able to load the tasmota scripting bin initially loading the tasmota basic bin gz file then uploaded the script bin.


Adding the script and template found here ==> hxxps://templates.blakadder.com/gosund_SW2.html have the switch working fine now.

>D 100
rng=235
dimh=""
slider=0
power=0
dimval=1
a=""
b=""
c=""
d=0
f=0
;set the hex code below to the largest value possible that will turn off the relay with SerialSend5
off=0x7f

>B
dp0
rng-=off
=#scDim(dimval)

>E
slider=Dimmer
if chg[slider]>0
then
; dim according slider
if slider>0 and dimval!=slider
then
dimval=slider
=#scDim(dimval)
=>SerialSend5 %dimh%
endif
endif

if pwr[1]!=power
then
if pwr[1]==1
then
=>SerialSend5 %dimh%
power=1
else
=>Serialsend5 00
power=0
endif
endif

a=SerialReceived
if sl(a)>0
then
;process the first and second hex nibbles
b=sb(a -8 1)
c=sb(a -7 1)
a=""
;convert the first nibble to decimal – max value is 0x60
f=b
f*=16
;handle second nibble which may be 0x0-0xf
d=c
if d==0
then
switch c
case "A"
d=10
case "B"
d=11
case "C"
d=12
case "D"
d=13
case "E"
d=14
case "F"
d=15
ends
endif
;add first and second nibbles then to Tasmota dimming path
f+=d
=>dimmer %f%
slider=f
endif

#scDim(dimval)
dimh=hn((rng*dimval/100)+off)
=>print Scaled brightness is %dimh%Using the scripting pieces allowed me to be able to manually dim the switch and see it dim in the console and use the GUI to dim and see the switch dimming leds illuminate.

08:50:06 MQT: stat/tasmota_C28A11/RESULT = {"POWER":"ON","Dimmer":50}
08:50:06 MQT: tele/tasmota_C28A11/RESULT = {"SerialReceived":"2403011C23240B011C232428011C23243C011C 232 446011C23244A011C23244C011C23"}
08:50:06 Scaled brightness is b5
08:50:06 Script: performs "SerialSend5 b5"
08:50:06 MQT: stat/tasmota_C28A11/RESULT = {"SerialSend":"Done"}

 



#3 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 02 July 2020 - 07:11 PM

02 July 2020 update
 
Configured 2nd Gosund dimmer switch.  Fast and easy using OTA.

0 - updated via OTA wirelessly and utilize powerline. 
1 - update installed Tasmota base with minimal base gz file
2 - install Tasmota script bin
3 - enter your Gosund template
4 - enter your Gosund script

Next going to see if I can install two of these side by side in a metal 4 X 4 box.

The two switches there are for garage and front door coach lamps.

#4 ryanwnzl

ryanwnzl

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 12 July 2020 - 08:29 AM

I am so excited to see a recent post on the Gosund SW2 with Tasmota.

I bought the 4 pack and installed two side by side in a double box.

Both ran well right out of box, great.

Then I flashed with Tasmota using Tuya-convert, seemed to take no problems.

Then I upgraded to recent Tasmota Firmware 8.3.1

Buttons didn't work but needed to add template still.

Added template from Blakadder for Gosund SW2 dimmer found here (https://templates.bl...gosund_SW2.html)::

{"NAME":"Gosund Dimmer","GPIO":[255,148,255,149,17,0,255,255,56,158,37,255,255],"FLAG":0,"BASE":18}

No response from switch in Tasmota?

Tried several other random templates, no response from any?

Tried creating template using digiblurDIY example here: (https://www.youtube....h?v=eDoIkd58HRM) - This is cool, worked great for other offbrand switch I had.

There was no response on any of the switch commands during this learning process?

 

I flashed and tried second switch. Exact same (non) response.

 

I was super excited to see a recent discussion with templates for Tasmota here. Looks like same template as Blakadder though.

 

Any advise is GREATLY appreciated as the switches are sort-of dead now and I don't really want to install/flash the remaining two yet.

Thank you in advance.

Any advise is GREATLY appreciated as the switches are sort-of dead now and I don't really want to install/flash the remaining two yet.



#5 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 12 July 2020 - 08:53 AM

Great news that you are able to to fit the two switches in one box. 

I have the two switches in place today at families house. Dimming of the outdoor LED lamps flickered a bit so switching the outdoor coach lamps to Philips clear candelabra standard base dimmer LED bulbs today. 
 
This was my first attempt at using Tasmota in a long time as I have only used Espurna mostly.
 
Guessing you used Tuya Convert 2.0 located here ==> hxxps://github.com/ct-Open-Source/tuya-convert
 
 
Here all of my testing was using an old computer power cord to just the power on the switch ==> black (hot) and white (neutral).
 
I did all of the programming here using my laptop running Ubuntu in a terminal session.
 
It is easy to get back to the Tasmota base by pressing the switch until it goes to programming mode.  My LED did not flash when I did this (a couple of times).
 
IE: here put the switch in to Espurna mode first then went to Tasmota.  Once you are in programming mode then you just have to look for the WiFi AP with your laptop and go to the device GUI and reset it to your local home WAP SSID.  Once you do this then restart it a couple of times to check it.
 
Then load up the basic tasmota bin in gz format.  Reboot it again and load up the scripting bin (gz).  Once you have the scripting bin in place then use the template and script found listed in the tasmota templates section.
 
The dimming and on and off physical controls will not work until you have done a copy and paste of the script and the script will not work until you have loaded a scripting bin firmware file.
 
BTW mine wouldn't work right until I used the Tasmota scripting bin and did a copy and paste of the script located under the template.
 
I also watched the youtube videos by digiBlurDIY.  Very good videos.
 
NOTE: Only use the template and script located here ==> hxxps://templates.blakadder.com/gosund_SW2.html
and no other one for this Gosund dimmer switch.
 
Try it it again and post your results here.

A quickie step by step review:

1 - test switch using just a computer cord to power up the switch
2 - switch over to Tasmota firmware using Tuya Convert 2.0 and connect Switch to your local WAP
3 - update firmware on switch over to Tasmota basic bin (GZ file)
4 - update firmware on switch over to Tasmota Scripting bin (GZ file)
5 - copy and paste template from posted web site for specific Gosund dimmer switch
6 - copy and past script from posted web site for specific Gosund dimmer switch
7 - enable template, reboot and test the dimmer touch and switch.

Everything should work fine.

#6 ryanwnzl

ryanwnzl

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 14 July 2020 - 09:16 PM

Cocoonut- Thank you so much.

I wanted to write back immediately, but the limit of one post per day would not allow me.

 

I have to say I am a bit lazy/stubborn and skipped some steps. but it is all working now.

What I did in relation to your steps:

 

1 - test switch using just a computer cord to power up the switch - didnt do

2 - switch over to Tasmota firmware using Tuya Convert 2.0 and connect Switch to your local WAP - didnt do this one either
3 - update firmware on switch over to Tasmota basic bin (GZ file) - didnt do this one either
4 - update firmware on switch over to Tasmota Scripting bin (GZ file) - this is where I started, but it would not accept the Scripting bin. So I installed the tasmota-minimal.bin.gz and then installed the scripting bin. This allowed for the Scripting option which I had not seen before.

5 - copy and paste template from posted web site for specific Gosund dimmer switch - did this, great
6 - copy and past script from posted web site for specific Gosund dimmer switch - did this (first time), great
7 - enable template, reboot and test the dimmer touch and switch - GREAT IT WORKS!!!

 

This was incredible and greatly appreciated.



#7 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 15 July 2020 - 05:42 AM

Great news!

 

This is the second time I have installed Tasmota in a couple of years via OTA.  I have been using mostly Espurna and using the wired method of upgrading the firmware.

 

I too skipped the steps in upgrading the Gosund dimmer switch in the beginning and it did not work until I installed the scripting bin and script per documentation on the templates site.



#8 nscharich

nscharich

    Newbie

  • New Member
  • Pip
  • 1 posts

Posted 27 July 2020 - 08:59 PM

Hey all!

 

I also just bought the 4 pack of the dimmer switches. This was the first flashing method that worked for me. I tried doing the onboard flashing via soldering with no success. The flash seemed to work, but now I am not able to do anything with the switch at all. All I get when I go to the ip address that I believe is the device is {"description":"not authorized"}. Here are the steps I did to get where I am at

  • downloaded and installed tuya-convert
  • was able to find the device and flash it with "Tasmota V8.1.0.2"
  • Connected it to my network via the login page
  • Found the device on my network using FING

However, now I am stuck and do not know what to do. What should be my next steps to resolve this? Thank you in advance and I am so excited to get these working!



#9 pete_c

pete_c

    Cocoonut

  • -=Gold Supporter=-
  • 10019 posts
  • Location:House
  • Experience:average
  • Software:Main Lobby, Open Source Automation
  • Hardware:HAI OmniPro II, Mi Casa Verde Vera, Ocelot
  • Tech:X10-PLC, X10-RF, UPB, INSTEON, Z-Wave, ZigBee, 1-Wire, xAP, xPL, ALC
  • Audio:Russound
  • Video:MythTV
  • CCTV:analog, ip, dvr
  • Phone:Asterisk, FreePBX, Ooma, POTS, VoIP via ISP

Posted 28 July 2020 - 09:51 AM

@nscharich

 

Welcome to the Cocoontech forum.

 

Great news on your Gosund dimmer endeavor.

 

Baby steps.

 

1 - Power off and power on your Gosund dimmer.

2 - clear the cache on your web browser

3 - upload the compressed Tasmota basic bin file

4 - upload the compressed Tasmota Script bin file

 

5 - copy and paste template to Gosund dimmer

6 - copy and paste script to Gosund dimmer

7 - configure to your liking.



#10 IoT

IoT

    Newbie

  • New Member
  • Pip
  • 1 posts

Posted Yesterday, 10:54 PM

Do you all have issues with the Dimmer being a little "quirky"? Like when your sliding it up or down, it randomly reverts back to a previous setting.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users