Hi All,
Im testing this great switch now and i love it!!! Here a nice example of script i use inside the switch.
Tap 1 turn on light
Tap again turn off light
hold the touch 3 seconds for a 3rd action
Actions are publish and SendToHTTP to activate devices inside domoticz, turn on light and turn on virtual switch.
Code: Select all
on Touch#Button=1 do
rtttl,5:d=8,o=5,b=999:9d.
timerSet,1,1
timerSet,2,1
timerSet,3,5
endon
on rules#timer=1 do
if [Touch#Button]=0 and [StatusMode#LightStatus]=0
TaskValueSet 6,3,1 // on
Publish domoticz/in,{"command": "setcolbrightnessvalue", "idx": 444, "hex": "ffffff", "brightness": 100 }
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Set Level", "level": 100 }
SendToHTTP 192.168.100.18,8081,/json.htm?type=command¶m=udevice&idx=471&nvalue=1&svalue=0
neopixel,1,0,255,0 // Green
else
TaskValueSet 6,3,0 // off
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Off" }
SendToHTTP 192.168.100.18,8081,/json.htm?type=command¶m=udevice&idx=471&nvalue=0&svalue=0
neopixel,1,255,0,0 // Red
endif
endon
on rules#timer=2 do
if [Touch#Button]=1
SendToHTTP 192.168.100.18,8081,/json.htm?type=command¶m=discomodenum9&idx=444
SendToHTTP 192.168.100.18,8081,/json.htm?type=command¶m=udevice&idx=471&nvalue=1&svalue=0
neopixel,1,0,0,255 // Blue
endif
endon
on rules#timer=3 do
neopixel,1,255,0,255 // Pink
endif
endon
on SwitchOn do
TaskValueSet 6,3,1
Publish domoticz/in,{"command": "setcolbrightnessvalue", "idx": 444, "hex": "ffffff", "brightness": 100 }
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Set Level", "level": 100 }
neopixel,1,0,255,0 // Green
timerSet,3,5
endon
on SwitchOff do
TaskValueSet 6,3,0
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Off" }
neopixel,1,255,0,0 // Red
timerSet,3,5
endon
Feedback action when you turn on virtual switch in Domoticz, so the Meek Switch go on as well and status will be on as well
those lines put in virtual switch at On Action and Off Action
http://192.168.100.112/control?cmd=event,SwitchOn
http://192.168.100.112/control?cmd=event,SwitchOff
in Meek Switch you have a second Rule 2:
Code: Select all
on SwitchOn do
TaskValueSet 6,3,1
Publish domoticz/in,{"command": "setcolbrightnessvalue", "idx": 444, "hex": "ffffff", "brightness": 100 }
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Set Level", "level": 100 }
neopixel,1,0,255,0 // Green
//timerSet,3,5
endon
on SwitchOff do
TaskValueSet 6,3,0
Publish domoticz/in,{"command": "switchlight", "idx": 444, "switchcmd": "Off" }
neopixel,1,255,0,0 // Red
//timerSet,3,5
endon
on rules#timer=3 do
neopixel,1,255,0,255 // Pink
endif
endon