Page 1 of 1
Calculate average values does not work
Posted: 30 Apr 2023, 17:00
by bastler11
Hello, I use 4 sensors with my ESP2866. One signal is not very stable, so I tried to use rules to get a stable value. But It does not work. The average value I got is about 74 instead of about 102? Here are some screenshots. Could you have a look on it? What is my mistake?
Thanks and best regards!
Re: Making average values does not work
Posted: 30 Apr 2023, 17:19
by Ath
The easiest way to get the average for task values is to enable the Stats checkbox, left from the Decimals setting for that Value, and use the [Zisterne_Inhalt#Prozent.avg] value in a rule:
Code: Select all
On Zisterne_Inhalt#Prozent Do
TaskValueSet,ZisInhalt,Dummy,[Zisterne_Inhalt#Prozent.avg] // Use .avg10 to get the average over the last 10 samples
Endon
Also see the documentation:
https://espeasy.readthedocs.io/en/lates ... statistics
Re: Calculate average values does not work
Posted: 30 Apr 2023, 17:32
by bastler11
Thanks,
I tried to do it, but values will not be shown?
Re: Calculate average values does not work
Posted: 30 Apr 2023, 18:58
by Ath
Did you disable or remove the rule with the same trigger? As only the first found instance will be executed (rules 1 .. rules 4 are read in that order, top down).
Re: Calculate average values does not work
Posted: 30 Apr 2023, 19:35
by bastler11
I deleted all rules and all Dummy Devices. Then I and wrote the rule for the content new. But the shown value is still 0.0?
Re: Calculate average values does not work
Posted: 30 Apr 2023, 19:41
by Ath
bastler11 wrote: ↑30 Apr 2023, 19:35
I deleted all rules and all Dummy Devices. Then I and wrote the rule for the content new. But the shown value is still 0.0?
But you still have a ZisInhalt Dummy Device, with a Dummy value? As I've used the TaskValueSet using the taskname and valuename, so these have to match for the value to be assigned (matching is
not case-sensitive).
Re: Calculate average values does not work
Posted: 30 Apr 2023, 20:47
by bastler11
I do not understand? Here are again some screenshots.
In the rule you send me: TaskValueSet,ZisInhalt,Dummy,[Zisterne_Inhalt#Prozent.avg] were have I to write it?
Re: Calculate average values does not work
Posted: 30 Apr 2023, 21:06
by Ath
The name of your Dummy Device task should be ZisInhalt, and the Name for the Values entry should be Dummy, like you originally had, that should fix it.
The ADS1115 task is already named Zisterne_Inhalt, you can't have 2 devices (tasks) with the same name.
Re: Calculate average values does not work
Posted: 30 Apr 2023, 21:20
by bastler11
No do not work. Were do I find the value Prozent.avg
Re: Calculate average values does not work
Posted: 30 Apr 2023, 21:40
by Ath
You have to enable the Stats checkbox on your ADS1115 task:

- Screenshot - 30-04-2023 , 21_37_41.png (38.31 KiB) Viewed 3736 times
(took a screenshot from this thread, above)
Re: Calculate average values does not work
Posted: 30 Apr 2023, 21:44
by bastler11

Thanks!
Re: Calculate average values does not work
Posted: 30 Apr 2023, 22:02
by bastler11
One more thing

.
I tried to use this function with an other device. But there I do not find the Stats checkbox. Do I have to update the firmware?
Re: Calculate average values does not work
Posted: 30 Apr 2023, 22:09
by Ath
That plugin does have Stats enabled, but because it is in a Collection build the Stats feature is excluded to limit the .bin size. You would have to build a Custom ESPEasy to have that enabled.
It should be available for an ESP32 Collection B build though, as an ESP32 has more space available for code.
Re: Calculate average values does not work
Posted: 30 Apr 2023, 22:20
by bastler11
Ok, than I have to change to ESP32.
Thanks again!