Extra API fields when bucket_step=1440

@dsj and @corrineb, I have been tracking down a bug in the PiConsole and I have noticed that the fields returned from a device endpoint API call vary based on the bucket_step. When the bucket_step is 1, 5, 30, or 180 minutes, the returned fields match the existing Implementation Notes for the API. However, when the bucket_step is 1440 minutes, there are a number of extra fields in the response that are not documented. These appear to be high/low/mean values, but I can’t work out exactly what everything is. The result is that the PiConsole is extracting data from the wrong fields when the bucket_step is 1440 minutes (e.g. when trying to calculate the number of lightning strikes over a year by summing the total number of lightning strikes per day).

Here are some examples of individual observations copied from the obs array for API requests with different bucket_steps. First for a Sky device:

"bucket_step_minutes":1440
[“2020-01-07”,2189,0.11,0.003804,0,1.42,8.67,230,16233,0,0.83,0,765,18,135,0,2.9,null,0,1,3,1,null]

"bucket_step_minutes":180
[1584921600,0,0.0,0,0,0.53,2.73,078,3.25,180,0,0,0,3,null,null,0]

"bucket_step_minutes":30
[1590969600,0,0.0,0,0,0.21,1.65,068,3.27,030,0,0,0,3,null,null,0]

"bucket_step_minutes":5
[1593561900,0,0.0,0,0,0.59,2.01,230,3.32,005,0,0,0,3,null,null,0]

"bucket_step_minutes":1
[1593561000,0,0.0,0,0,0.49,0.94,224,3.33,001,0,0,0,3,null,null,0]

and a Tempest device:

"bucket_step_minutes":1440
[“2020-05-22”,1016.4,1018.2,1015.6,18.9,20.1,17.4,94,98,87,6954,28023,0,0.4,1.74,0,58,234,0,0.49,4.16,0,299,3,0,0,528,2.56,0.192568,null,18,null,1,0]

"bucket_step_minutes":180
[1591088400,0.00,0.31,1.79,342,3,1016.5,11.3,89,0007,0.00,00,0,0,0,0,2.55,180,0,0,0,1]

"bucket_step_minutes":30
[1592713800,0.00,0.00,0.00,000,3,1014.2,19.2,98,0000,0.00,00,0,0,0,0,2.49,030,0,0,0,1]

"bucket_step_minutes":5
[1593129600,0.00,0.28,0.85,146,3,1012.4,22.1,83,1628,0.04,14,0,0,0,0,2.49,005,0,0,0,1]

"bucket_step_minutes":1
[1593561000,0.31,1.09,1.79,349,3,1008.9,24.6,72,6210,0.42,52,0,0,0,0,2.52,001,0,0,0,1]

I would assume similar behaviour for an Air device, but I haven’t tested it. Can you provide documentation for the additional fields when bucket_step = 1440?

Hi Peter,

You are correct. The API response for the 1440 bucket step is different than the others. Here is the structure for the 1440 records. If you have any questions let me know.

SKY
0 - TIMESTAMP
1 - LUX
2 - UV
3 - PRECIP_ACCUM_TODAY_LOCAL
4 - WIND_LULL
5 - WIND_AVG
6 - WIND_GUST
7 - WIND_DIR
8 - LUX_HIGH
9 - LUX_LOW
10 - UV_HIGH
11 - UV_LOW
12 - RECORD_COUNT
13 - SOLAR_RADIATION
14 - SOLAR_RADIATION_HIGH
15 - SOLAR_RADIATION_LOW
16 - BATTERY
17 - PRECIP_ACCUM_TODAY_LOCAL_FINAL
18 - PRECIP_ANALYSIS_TYPE
19 - PRECIP_MINS_TODAY_LOCAL
20 - WIND_INTERVAL
21 - PRECIP_TYPE
22 - PRECIP_MINS_TODAY_LOCAL_FINAL

AIR
0 - TIMESTAMP
1 - PRESSURE
2 - TEMP
3 - HUMIDITY
4 - STRIKE_COUNT
5 - STRIKE_AVG_DISTANCE
6 - TEMP_HIGH
7 - TEMP_LOW
8 - PRESSURE_HIGH
9 - PRESSURE_LOW
10 - HUMIDITY_HIGH
11 - HUMIDITY_LOW
12 - RECORD_COUNT
13 - BATTERY

Tempest
0 - TIMESTAMP
1 - PRESSURE
2 - PRESSURE_HIGH
3 - PRESSURE_LOW
4 - TEMP
5 - TEMP_HIGH
6 - TEMP_LOW
7 - HUMIDITY
8 - HUMIDITY_HIGH
9 - HUMIDITY_LOW
10 - LUX
11 - LUX_HIGH
12 - LUX_LOW
13 - UV
14 - UV_HIGH
15 - UV_LOW
16 - SOLAR_RADIATION
17 - SOLAR_RADIATION_HIGH
18 - SOLAR_RADIATION_LOW
19 - WIND_AVG
20 - WIND_GUST
21 - WIND_LULL
22 - WIND_DIR
23 - WIND_INTERVAL
24 - STRIKE_COUNT
25 - STRIKE_AVG_DISTANCE
26 - RECORD_COUNT
27 - BATTERY
28 - PRECIP_ACCUM_TODAY_LOCAL
29 - PRECIP_ACCUM_TODAY_LOCAL_FINAL
30 - PRECIP_MINS_TODAY_LOCAL
31 - PRECIP_MINS_TODAY_LOCAL_FINAL
32 - PRECIP_TYPE
33 - PRECIP_ANALYSIS_TYPE

2 Likes

Thanks for sharing this @corrineb, it’s super useful!

2 Likes

What do the _FINAL fields represent?
–Sam

The final fields are the rain accumulation totals after Rain Check has run.

1 Like

Thanks! I was assuming that… but you know what ‘assume’ means… :smiley:

1 Like

Anyone have a breakdown on what is included in this message type?

It appears to be a daily summary (high,avg,low)… but a bit 'o documentation would be nice.
–Sam

Is this what you are looking for: Extra API fields when bucket_step=1440

1 Like

Yes… and that NEEDS to be added to the API documentation.
And…
Tempest
0 - TIMESTAMP
1 - PRESSURE
2 - PRESSURE_HIGH
3 - PRESSURE_LOW

But, in reality index [0] there is the Date… but what is [1]? If it IS Lux, per that link… then the ‘TIMESTAMP’ is not a timestamp, but rather just the date…

And here is a sample from my SKY:
[
0: “2020-01-01”,
1: 13106,
2: 0.57,
3: 0,
4: 0,
5: 0.3,
6: 4.87,
7: 57,
8: 80764,
9: 0,

Hi Sam. It’s not documented because the bucketing concept started out as something specific to the Tempest apps that was not going to be part of the public API. We probably will make it public and document it as time permits but you should use this (and any other undocumented things you may find) at your own risk, since they are subject to change or removal without notice (though it’s pretty unlikely we wouldn’t give you some kind of notice :slight_smile: )

Thanks for the head’s up…
I “found” this by using the REST Reference…

Hmm… I forgot about that… the API will automatically switch to different buckets based on the time request… well now I guess we HAVE to make it public :smiley:

1 Like

Always here to “help”!
–Sam

1 Like