Hello,
can someone please help me to understand, how average works? I send data from temperature sensor to Thingspeak roughly every 5 min(DIFF column in seconds). If i dont use average, i can see temperature in more less 5min slots around 20 degrees. See DATUM and TEPLOTA field on first image(Vlhkost is humidity).
I supposed, if i use parameter average=60, it will calculate average temperature in time slot 60min and extract it. But if you check second image with same data, only parameter average=60 added, results are crazy. I can see rows per hour, but values are crazy, around 7 degrees. I really dont understand what system calculate. I get exactly same result on thingspeak page in channel setup, so problem is not with my page.
Thingspeak screenshots 1day without average
1day with average 60
settings i changed
7 Comments
Time DescendingI believe your code is updating separate fields of data in each update. You can confirm this by exporting the data in your channel from the "Import/Export data" tab of your channel. What you will find is that there is a pattern where field 1 & 2 are updated, but fields 3-8 are NULL. In a separate update fields 1 & 2 are NULL and 3 & 4 have a value and others are NULL. In a 3rd update, fields 1-4 are NULL and fields 5-8 have a value.
Note that when the average is calculated, the NULLs are treated as zeros. You can avoid this situation by updating all 8 fields simultaneously rather than the current pattern you have.