Logo
Gosund SW2 Dimmer
US
Gosund SW2

Available from:
Amazon.com
Aliexpress.com



Manufacturer:
Us.gosund.com

Install method:
Tuya-Convert

GPIO #Component
GPIO00 User
GPIO01 Serial Tx
GPIO02 User
GPIO03 Serial Rx
GPIO04 Button1
GPIO05 None
GPIO09 User
GPIO10 User
GPIO12 Led1i
GPIO13 LedLinki
GPIO14 PWM1
GPIO15 User
GPIO16 User
FLAG None
Configuration (old version)
{"NAME":"Gosund Dimmer","GPIO":[255,148,255,149,17,0,255,255,56,158,37,255,255],"FLAG":0,"BASE":18}
Tuya-Convert might not be possible for this device since the template was added (2019-12-10). All new Tuya devices have firmware preventing flash but it is still possible to Tuya-Convert old stock devices without connecting them to the Tuya app.

In order to be able to flash the device from the pins, make sure to disconnect the front panel from the rest of the device. If not done, the tuya MCU will prevent the ESP chip to be flash.

To use the script, you have to compile Tasmota with Scripting enabled. Download unofficial precompiled firmware from development branch.

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.

Status codes take the form of 24xx012123, with xx ranging from 01 to 64 (hex 1-100).

Minimum dimming level may vary by light fixture - adjust the ‘off’ value to match your setup in the >D section.

>D 100
rng=235
dimh=""
slider=0
power=0
dimval=1
a=""
b=""
c=""
d=0
f=0
g=""
;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
a=SerialReceived
if sl(a)>0
then
g=sb(a 0 2)
if sl(a)==47
then
b=sb(a -5 2)
else
b=sb(a -8 2)
endif
a=""
if g=="24"
then
f=hd(b)
=>dimmer %f%
slider=f
dimval=slider
=#scDim(dimval)
=>SerialSend5 %dimh%
endif
else
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
endif

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

#scDim(dimval)
dimh=hn((rng*dimval/100)+off)
=>print Scaled brightness is %dimh%

Alternatively, you can flash with a 9.0.0 version of tasmota customized for this switch. It is a bit simpler, since it requires no scripting, just choosing the module Gosund Dimmer (76), and fixes a bug in this setup. Discussion is here: http://cocoontech.com/forums/topic/32175-gosund-wifi-dimmer-replacing-firmware/page-3 amd the binary can be found here: https://github.com/gbg108/Tasmota/releases/tag/v9.0.0.3_GS1.1

2021-10-11 Bought on Amazon pack of 2 switch dimmer. Model is written DS1. try All the info with special firmware or with the latest tasmota + the script and the dimmer does not correctly work. look like the gosund DS1 is and upgrade of SW2 and some hardware change prevent working correctly with provided infos, waiting to get update to fix