when it's single press => send command to power on the light => publish cmnd/dimmer/power TOGGLE
when it is first time longpress => send the command to increase the dimmer => cmnd/dimmer/DIMMER +
when it is second time longpress => send the command to decrease the dimmer => cmnd/dimmer/DIMMER -
then the third time come back to "+" and so on.
of course it continue to send the command "+" or "-" till the duration of the pressing
the actual rule that manage it in tasmota is:
Code: Select all
rule2 ON system#boot DO Backlog var1 +; var2 1 ENDON
ON switch1#state=2 DO publish cmnd/dimmer/power TOGGLE ENDON
ON switch1#state=4 DO publish cmnd/dimmer/DIMMER %var1% ENDON
ON switch1#state=7 DO mult2 -1 ENDON
ON var2#state==-1 DO var1 - ENDON
ON var2#state==1 DO var1 + ENDON
ON dimmer#state==1 DO mult2 -1 ENDON
ON dimmer#state==100 DO mult2 -1 ENDON
for short press to toggle the power is very easy, but how i can perform that fist time that i longpres it published
Code: Select all
cmnd/dimmer/DIMMER +
and second time that is longpressed will publish
Code: Select all
cmnd/dimmer/DIMMER -
the third time taht is longpressed publish
Code: Select all
cmnd/dimmer/DIMMER +
the fourth time that is longpressed publish
Code: Select all
cmnd/dimmer/DIMMER -
and so on?
thanks