Pleas find enclosed a document explaining the let fucntion
Found on several forum discussions
Good reading
Patou
Esp Easy internal variables
There are 16 definable internal variables :
Let,<value number 1...16>,<float>
Example
Let,1,10
Let,2,20
Publish,Answer/%v1%+%v2%,(%v1%+%v2%)
or
Publish,Answer/[var#1]%+[var#2],([var#1]%+[var#2])
This would render in this being published
Topic
Answer/10+20
Message 30
New way :
On System#Boot Do
Let,1,123456789
EndOn
On esp004#tag Do
Let,2,[esp004#tag] //Setting dummy value 1 to the tag code
TimerSet,1,3
EndOn
On Rules#Timer=1 Do
If [esp004#tag] = %v2%
taskValueSet,1,1,%v1%
EndIf
Old way :
On System#Boot Do
taskValueSet,12,2,123456789
EndOn
On esp004#tag Do
taskValueSet,12,1,[esp004#tag] //Setting dummy value 1 to the tag code
TimerSet,1,3
EndOn
On Rules#Timer=1 Do
If [esp004#tag] = [Dummy#CurrentTag] //If the tag code is still the same after 3 seconds clear it
taskValueSet,1,1,[Dummy#ZeroTag]
EndIf
EndOn
Is it possible to create a feature so you can do some elementary basic signal processing on
• the sensor signals? searched the issue tracker or the forum for a similar issue. (include links when applicable) But i did not find any info on this
•
• There is a rather elaborate filter option which you can already use now.
You can store values in a variable when using rules. Something similar can also be done using the dummy plugin.
These values can then be used in a computation (in the rules).
For example new value = (3* last_value + new sample) / 4
And then store that new value in the variable to be used in the next run as "last_value".
• But I agree that some statistics module would be very useful.
On the other hand, if the values jump 4 degree between samples, then you can ask yourself how useful these are.
So maybe better to look into why these values are so unstable.
Ah, what you describe is what i meant, but didn't realize it was there. maybe close the request than.
But i'm very new to this, so not sure how to do that precisely. I found the rule tab now.
I copied the new value = (3* last_value + new sample) / 4 there but do not know how to put the And then store that new value in the variable to be used in the next run as "last_value". to work.....
Could you give an example, or a headsup where to look? (as i mentioned, really new here)
I will summon the rules guru by mentioning him

@Grovkillen may be able to help here.
Or if it will end up in a discussion on how to do stuff instead of things that are buggy or need to change, then it may be best to move it to the forum.
This is what I would try first. I store the last 9 values and add the newest value to that making it 10 values all in all. The average of those ten is then added to a dummy variable (task 12 in this example) which is then later used as the publishing task.
On Temp#Value Do
Let,10,[VAR#9]
Let,9,[VAR#8]
Let,8,[VAR#7]
Let,7,[VAR#6]
Let,6,[VAR#5]
Let,5,[VAR#4]
Let,4,[VAR#3]
Let,3,[VAR#2]
Let,2,[VAR#1]
Let,1,[Temp#Value]
TaskValueSet,12,1,([VAR#1]+[VAR#2]+[VAR#3]+[VAR#4]+[VAR#5]+[VAR#6]+[VAR#7]+[VAR#8]+[VAR#9]+[VAR#10])/10
EndOn
Right at boot all the internal variables will be 0 making this rule not working great for the first ten loops.
PS. TaskValueSet could be accompanied by TaskRun in order to have the value being published in the same intervals as the actual sensor is set to (in this example named Temp#Value). I close this one now.
Why use 10 samples? If you only use the a weighted average of the last reported value (not measured) combined with the last measured value, you will achieve similar filtering but a lot easier to implement in rules.
Only drawback is that you will still have some residue left of old values when the measured values suddenly change a lot. Taking the average of a fixed amount of samples will have no "memory" after N samples.
So it depends on the use case which is better.
For example on a scale you want a fast response (using average filtering), but when keeping track of air pressure you don't want to see someone slamming the door.
On Temp#Value Do
Let,2,[VAR#1]*3
Let,1,[Temp#Value]
TaskValueSet,12,1,([VAR#1]+[VAR#2])/4
EndOn