i would like to know if and if yes, how to change teh value of a state using rules.
I have one push button define device switch input, push button active low, pullup pn, gpio0, named pb01.
With the followin code,
Code: Select all
// pb01 - gpio 0 - D5
// output - gpio 2 - D3
On System#Boot do
let,1,0 // future enhancement by VAR
endon
on pb01#value do
if [pb01#value]=1
GPIO,2,1
else
GPIO,2,0
endif
endon
on pb01_on do
GPIO,2,1
endon
on pb01_off do
GPIO,2,0
endon
it works. pusing button, output is on (by devices, value 1), push again, it's off (by devices, value 0).
now, by off, by devices, value 0
using web:
http://192.168.1.5/control?cmd=event,pb01_on output in on, and by devices, value does not change, remains 0.
i push the button, nothing happens, i push it a second time, and output is off, and value by devices is ok.
Is there a way to change the value inside the rule, so either by physical button or by web - http cmd, the value reflects the action, so after using http, the state / value is correct and pushing the button it works, without having to push twice?
TIA