First of all, the Wiki documentation is outdated. Please use the ReadTheDocs documentation:
https://espeasy.readthedocs.io/en/latest/
There is a number of ways to accomplish this:
- Use dummy tasks to store the values
- Use variables within rules.
A dummy task can be filled from the rules using the taskvalueset command.
You can "run" a dummy task by calling taskrun from the rules, which will send all values from that task to any connected controller.
If you're not using a dummy task, you need to store the values in a variable and then do whatever you need to do with them. e.g. format them into an URL for a http call.
N.B. variables will be erased after a reboot, where task values will be restored after a reboot (without power loss).
However, since you will be updating these dummy task values every N seconds, this does not have any benefit in this use case.
Some example rules code for you.
I assume your pulsecount tasks are called "gas" and "energy" and you have to check for yourself what task value you want to use. I just call it "count" but you may need to change that in your setup.
Code: Select all
on energy#count do
let,1,(%eventvalue1%*60) // 1: W -> %value%*3600/2/30
let,2,[var#2]+(%eventvalue1%/2000) // 2: kWh -> %value%/2000
logentry,"[var#1] Watt [var#2] kWh"
endon
As you can see, I assigned the values on every read of the pulsecount task named "energy" to variables 1 and 2 and log them.
This will be done each "Interval" nr of seconds of your task. (see at the bottom of the task configuration page)
But you can also set the rules to do this every minute or set a specific timer for it.
Then you don't have the value in the %eventvalueX%, but you have to fetch it via [energy#count] notation.
See the Rules documentation for more inspiration:
https://espeasy.readthedocs.io/en/lates ... Rules.html