OK, I think we're approaching this the wrong way...
What we now do is you post something, we react on some part of what we think is wrong, you try to use this answer to something else, repeat...
Let's first make clear what you want to achieve...
What I think you plan to do:
- On new sample values, copy them to a dummy task
- At specific time interval, send from the dummy task to some controller
But the same can be achieved by "collecting" all values instead of acting on an event.
Using elegant tricks are nice to have, like with the %eventpar%, but it doesn't help understanding what steps are needed.
So let's start with the basics, which are easy to understand.
Later we can make it more elegant.
You did start with the most basic approach (which is fine to begin with)
Code: Select all
On Clock#Time=All,**:** do // this event comes in every minute
TaskValueSet 5,1,[bme280#teplota]
TaskValueSet 5,2,[winddir#winddir]
TaskValueSet 5,3,[windspeed#windspeed]
endon
But this one is occuring a bit too often, so better start using a (loop)timer: (
Documentation)
Code: Select all
On System#Boot do //When the ESP boots, do
looptimerset,1,1200 // Start loop timer 1, 1200 sec (=20 mins) interval
endon
On Rules#Timer=1 do
TaskValueSet 5,1,[bme280#teplota]
TaskValueSet 5,2,[winddir#winddir]
TaskValueSet 5,3,[windspeed#windspeed]
endon
This does start a loop timer (= a timer which restarts itself) with interval of 1200 sec (= 20 mins).
We use timer 1 for this.
You can see the task values of the dummy task at task index #5 being filled.
For testing, you may want to reduce the looptimer interval to something like 60 sec.
N.B. you can simply give the looptimer command from the tools page in the command box.
The dummy task values are being filled with the latest sample data from the referred sensors.
However it is not being "sent" to the connected controller(s).
For this we need to "run" the dummy task to "flush" the data to the connected controller(s).
Code: Select all
On System#Boot do //When the ESP boots, do
looptimerset,1,1200 // Start loop timer 1, 1200 sec (=20 mins) interval
endon
On Rules#Timer=1 do
TaskValueSet 5,1,[bme280#teplota]
TaskValueSet 5,2,[winddir#winddir]
TaskValueSet 5,3,[windspeed#windspeed]
TaskRun,5 // Flush the data to the connected controller(s)
endon
Let me know if this part is clear before we continue.