Calculate average values does not work

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Calculate average values does not work

#1 Post by bastler11 » 30 Apr 2023, 17:00

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!
Attachments
Screenshot_5.jpg
Screenshot_5.jpg (128.45 KiB) Viewed 2090 times
Screenshot_4.jpg
Screenshot_4.jpg (47.91 KiB) Viewed 2090 times
Screenshot_3.jpg
Screenshot_3.jpg (212.88 KiB) Viewed 2090 times
Screenshot_1.jpg
Screenshot_1.jpg (128.62 KiB) Viewed 2090 times

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Making average values does not work

#2 Post by Ath » 30 Apr 2023, 17:19

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
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#3 Post by bastler11 » 30 Apr 2023, 17:32

Thanks,

I tried to do it, but values will not be shown?
Attachments
Screenshot_6.jpg
Screenshot_6.jpg (21.32 KiB) Viewed 2083 times
Screenshot_2.jpg
Screenshot_2.jpg (54.71 KiB) Viewed 2083 times

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Calculate average values does not work

#4 Post by Ath » 30 Apr 2023, 18:58

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).
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#5 Post by bastler11 » 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?

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Calculate average values does not work

#6 Post by Ath » 30 Apr 2023, 19:41

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).
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#7 Post by bastler11 » 30 Apr 2023, 20:47

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?
Attachments
Screenshot_10.jpg
Screenshot_10.jpg (97.19 KiB) Viewed 2069 times
Screenshot_9.jpg
Screenshot_9.jpg (48 KiB) Viewed 2069 times
Screenshot_8.jpg
Screenshot_8.jpg (96.04 KiB) Viewed 2069 times

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Calculate average values does not work

#8 Post by Ath » 30 Apr 2023, 21:06

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.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#9 Post by bastler11 » 30 Apr 2023, 21:20

No do not work. Were do I find the value Prozent.avg
Attachments
Screenshot_12.jpg
Screenshot_12.jpg (92.09 KiB) Viewed 2064 times
Screenshot_11.jpg
Screenshot_11.jpg (85.55 KiB) Viewed 2064 times

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Calculate average values does not work

#10 Post by Ath » 30 Apr 2023, 21:40

You have to enable the Stats checkbox on your ADS1115 task:
Screenshot - 30-04-2023 , 21_37_41.png
Screenshot - 30-04-2023 , 21_37_41.png (38.31 KiB) Viewed 2033 times
(took a screenshot from this thread, above)
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#11 Post by bastler11 » 30 Apr 2023, 21:44

:) Thanks!

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#12 Post by bastler11 » 30 Apr 2023, 22:02

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?
Attachments
Screenshot_13.jpg
Screenshot_13.jpg (137.29 KiB) Viewed 2029 times

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Calculate average values does not work

#13 Post by Ath » 30 Apr 2023, 22:09

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.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: Calculate average values does not work

#14 Post by bastler11 » 30 Apr 2023, 22:20

Ok, than I have to change to ESP32.

Thanks again!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 144 guests