-
-
Save thxthx0/12074f1f5249e14b2a0aada75f590c9b to your computer and use it in GitHub Desktop.
>D | |
sw=0 | |
tmp=0 | |
cnt=0 | |
tmr=0 | |
hold=0 | |
pwrt=0 | |
slid=0 | |
dim="" | |
doff="FF550005DC0A" | |
splo=2 ;short press lolimit | |
spup=10 ;short press uplimit | |
ddir=0 ;dim dir 0/1 | |
dmul=2.2 ;dim multipl 1..2.55 | |
dstp=2 ;dim step/speed 1..5 | |
dlo=15 ;dim lolimit min.0 | |
dup=95 ;dim uplimit max.100 | |
dval=50 ;start dim level 0..100 | |
>B | |
print > Wifi-1CH-Dimmer-Script v2.0b < | |
print >> QS-WiFi-D01 150W Dimmer << | |
;hide cnt webui | |
->WebSensor1 0 | |
;reset cnt@teleperiod | |
->SetOption79 1 | |
->Baudrate 9600 | |
;boot sequ | |
=#snddim(dval) | |
delay(1000) | |
->SerialSend5 %doff% | |
=>Power1 0 | |
>F | |
cnt=pc[1] | |
if chg[cnt]>0 | |
;sw press | |
then sw=1 | |
else sw=0 | |
;sw not pressed | |
endif | |
; 100ms timer | |
tmr+=1 | |
; short press | |
if sw==0 | |
and tmr>splo | |
and tmr<spup | |
then | |
pwrt^=1 | |
;change on/off | |
if pwrt>0 | |
then | |
=#snddim(dval) | |
=>Power1 1 | |
else | |
->SerialSend5 %doff% | |
=>Power1 0 | |
endif | |
endif | |
; long press | |
if sw>0 | |
then | |
if tmr>spup | |
then | |
hold=1 | |
;off then on | |
if pwrt==0 | |
then | |
pwrt=1 | |
endif | |
;dim when on&hold | |
if pwrt>0 | |
then | |
if ddir>0 | |
then | |
;incr dimlevel | |
dval+=dstp | |
if dval>dup | |
then | |
;up limit change dir | |
delay(700) | |
ddir^=1 | |
endif | |
else | |
;decr dimlevel | |
dval-=dstp | |
if dval<dlo | |
then | |
;lo limit change dir | |
delay(700) | |
ddir^=1 | |
endif | |
endif | |
endif | |
endif | |
else | |
tmr=0 | |
if hold>0 | |
then | |
hold=0 | |
;change dim dir | |
ddir^=1 | |
endif | |
endif | |
if chg[dval]>0 | |
then | |
=#snddim(dval) | |
=>Dimmer %dval% | |
endif | |
>E | |
; slider | |
slid=Dimmer | |
if chg[slid]>0 | |
then | |
; dim per slider | |
if slid>0 | |
then | |
dval=slid | |
else | |
pwrt=0 | |
endif | |
endif | |
>P | |
; on/off webui | |
if pwr[1]>0 | |
then | |
pwrt=1 | |
dim="FF55"+hn(dval*dmul)+"05DC0A" | |
->SerialSend5 %dim% | |
else | |
pwrt=0 | |
->SerialSend5 %doff% | |
endif | |
; subroutine | |
#snddim(tmp) | |
dim="FF55"+hn(tmp*dmul)+"05DC0A" | |
->SerialSend5 %dim% | |
# |
Hi thxThx0!
Thank you for your great job!
I have an QS-WIFI-D02-TRIAC 1 Chanel Dimmer and your script worked with Tasmota 9.2.0.6 good....
With the button it works perfect, but the toggle in Tasmota dont switch on or off.
When i turn the brightness on minimun the light goes off.
I am too stupid do understand the code, hopefully you can help?
Have a nice day
Hi @oberlinatgithub,
I don't know if there are any differences between QS-WIFI-D01 and D02, I only have D01.
brightness on minimum and the light goes off is ok,
but with power toggle or moving the slider it should come on again.
Maybe the whole script was not inserted due to more memory limitations in previous Tasmota versions (?),
would be worth a try with Tasmota 9.5+
Hi, I just upgraded to tastmota 10.0.0.3 and it's the same for me.
The dimmer works, but on/off does not?
In the console I get an error: var not found: Dimmer
The dimmer works, but on/off does not?
Hi,
this must be set in my_user_config.h / user_config_override.h:
#define USE_SCRIPT // Add support for script (+17k code)
#define SCRIPT_POWER_SECTION // enable >P section (execute on power changes)
or you may use:
https://github.com/tasmota/install/blob/main/firmware/unofficial/tasmota-scripting.bin
or
https://github.com/tasmota/install/blob/main/firmware/unofficial/tasmota-scripting.bin.gz
Nice! I recompiled v10.0.0.3 with #define SCRIPT_POWER_SECTION and that worked like a charm.
Thanks a lot! :)
Michael
Hi, Tasmota 9.5.0 ... Script for QS-WiFi-D01-TRIAC 150W 1CH-Dimmer
(changes the dimming direction when min/max brightness is reached and doesn't stop dimming)
Template:
{"NAME":"QS-WiFi-D01
150WDimmer","GPIO":[0,3200,0,3232,0,0,0,0,0,352,416,0,0,1],"FLAG":0,"BASE":18}
Info:
https://templates.blakadder.com/qs-wifi_D01_dimmer.html
precompiled tasmota-scripting.bin / tasmota-scripting.bin.gz files:
https://github.com/tasmota/install/tree/main/firmware/unofficial