I had i typo in my last rules... there was a "." after the zero 0.
Thats why it probably did not work.
I should explain the code better:
Code: Select all
On System#Boot Do
TimerSet,1,5 //after boot set a timer of 5 seconds to let everything initialize properly so that the analog input device has enough time to gather data
Endon
On Rules#Timer=1 Do
Let,1,1 // when the timer has finished set the variable number 1 to 1 (it sets back to 0 after every reboot)
Endon
On niveau_puit#Analog Do
If [var#1] = 1 And %eventvalue1% > 0 //this should work but you have to either reboot your device after saving rules or set var#1 to 1 in the tools tabs command field with Let,1,1
TaskValueSet,2,DummyPuit,%eventvalue1%. //the 2 can also be replaced by the name of the device
Endif
Endon
Silicium81 wrote: ↑27 Oct 2023, 21:12
Now it works, values less than one are no longer transmitted.
Right now only values bigger than 0,1 are transmitted
For bigger than one changed to:
Code: Select all
If [var#1] = 1 And %eventvalue1% > 1
So there is nothing really wrong with your code but in your version the first two rule blocks (on boot... and on rules#timer..) are unnecessary and your value check as stated before does something different from what you stated.
And always prefer %eventvalue% over [<taskname>#<value>] in the same block
from the docs:
Note
Whenever an event is generated that includes values, these are kept with the event until it is executed. This ensures that when the event is processed, the values at the moment the event happened are passed for processing.
To avoid using ‘unexpected’ values, especially on for sensors with fast-changing values, it is strongly advised to use the %eventvalueN% variables over the [<taskname>#<value>] notation that will retrieve the current value from the task. A next event will handle the later, updated, values.