- One analog input device is read every 1/2 hour. To do this physical device is switched on by GPIO12 (by use of a transstor - it's not important for my problem)
- The value of the analog input is copied to the dummy device 11. This dummy device is sending its value on change to controller 1.
Everything works fine while normal operation. But every time the WeMos is booting the value of the dummy device (which is 0 at this stage) is send to the controller before something is copied from the analog device. I had tried many different versions to avoid this "0" in my log, but nothing helps. It seems that the very first event is set something to the dummy can't be avoid. Is this true or is there a failure from me?
(Hope one can understand what I want to say....)
Code: Select all
On System#Boot do
timerSet,1,0
TaskValueSet,12,1,0 // Set vars#activation = 0
TaskValueSet,12,2,1 // Set vars#sent = 1
timerSet,2,10 // Start first automatic cycle after 10 sec.
timerSet,8,60 // Set Timer 8 for notify by mail in 60 seconds
endOn
On Clock#Time=All,1:50 do // Reboot every night
timerSet,7,55
Endon
on Rules#Timer=7 do
WifiDisconnect
Reboot
endOn
On Rules#Timer=8 do // Send Mail after Boot
notify 1, "WEMOS-2: System gestartet"
endOn
On activate do // Manual start per browser or FHEM
GPIO,12,1 // Set GPIO12(D6)=1 (Turn on the transistor)
TaskValueSet,12,1,1 // Set vars#activation = 1
TaskValueSet,12,2,0 // Set vars#sent = 0
timerSet,1,6
timerSet,2,1800 // Restart cycle every 1/2 hour
endOn
On Rules#timer=2 do // Automatic cycle by internal timer
GPIO,12,1 // Set GPIO12(D6)=1 (Turn on the transistor)
TaskValueSet,12,1,1 // Set vars#activation = 1
TaskValueSet,12,2,0 // Set vars#sent = 0
timerSet,1,6
timerSet,2,1800 // Restart cycle every 1/2 hour
endOn
On paw#value do
If [vars#activation]>0 and [vars#sent]=0
TaskValueSet,11,1,[paw#value] // Write data from analog input to dummy and send this to controller 1 (FHEM)
TaskValueSet,12,2,1 // Set vars#sent = 1
endIf
endOn
On Rules#timer=1 do
GPIO,12,0 //Set GPIO(D6)=0 (Turn off the transistor)
TaskValueSet,12,1,0 // Set vars#activation = 0
endOn