Aggregated values on higher scales?

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
TobiasL
Posts: 3
Joined: 22 Dec 2015, 15:11

Aggregated values on higher scales?

Post by TobiasL » 23 Dec 2015, 10:14

Hi,

when requesting a temperature value with scale of 1day, will the resulting value be the average temperature of this day?

The documentation for getmeasure states for the real_time option
In scales higher than max, since the data is aggregated, the timestamps returned are by default offset by +(scale/2).
For instance, if you ask for measurements at a daily scale, you will receive data timestamped at 12:00 if real_time is set to false (default case), and timestamped at 00:00 if real_time is set to true.
It mentions "aggregated", so I assume it will be the average temperature. But if I request SCALE_MAX for one day and calculate the average temperature, this doesn't match the value of SCALE_1DAY for the same day (regardless if real_time set to true or false).
Could you please elaborate on this matter?

Thanks a lot
Tobias

trosenblatt
Posts: 233
Joined: 18 Sep 2012, 12:18

Re: Aggregated values on higher scales?

Post by trosenblatt » 23 Dec 2015, 10:41

Hi Tobias,

indeed temp at scale 1day is your mean temperature for your day in your timezone
If you find different average value could you please post your request and the reponse ?
Regards,
Thomas Rosenblatt, Netatmo Team.

TobiasL
Posts: 3
Joined: 22 Dec 2015, 15:11

Re: Aggregated values on higher scales?

Post by TobiasL » 25 Dec 2015, 17:43

Hi Thomas,

Thank you for your reply.
I think I've found the problem. It has to do with the specified date range in both requests.

First my request with scale max (via the php netatmo client):

Code: Select all

$params = [
    'access_token' => $token['access_token'],
    'device_id' => '70:ee:50:14:62:7c',
    'module_id' => '02:00:00:14:53:ae',
    'date_begin' => 1450742400, // 2015-12-22 00:00:00+00:00
    'date_end' =>  1450828799,  // 2015-12-22 23:59:59+00:00
    'scale' => 'max',
    'type' => 'Temperature',
    'real_time' => true,
    'optimize' => false
];
I get 296 measurements, starting from
1450742430 (2015-12-22 00:00:30+00:00): 11.3
to
1450828612 (2015-12-22 23:56:52+00:00): 11.7

Average is 3539.9 / 296 = 11.959121621622

Then I do a request with scale 1day for the same date range:

Code: Select all

$params = [
    'access_token' => $token['access_token'],
    'device_id' => '70:ee:50:14:62:7c',
    'module_id' => '02:00:00:14:53:ae',
    'date_begin' => 1450742400, // 2015-12-22 00:00:00+00:00
    'date_end' =>  1450828799,  // 2015-12-22 23:59:59+00:00
    'scale' => '1day',
    'type' => 'Temperature',
    'real_time' => true,
    'optimize' => false
];
$measurements = $client->api('getmeasure', $params);
With this I get one measurement:
1450825200 (2015-12-22 23:00:00+00:00): 11.1

Although using everywhere UTC time zone there is a shift of one hour in the returned timestamp (Perhaps this is because the location of the device is in GMT+1?). So I think the returned value doesn't match the requested date range and belongs to the next day.

When I request one day earlier, I get

1450738800 (2015-12-21 23:00:00+00:00): 11.9

which is nearly 11.95 and would be equivalent to 2015-12-22 00:00:00+01:00

I would expect to be able to do both requests within the same date range in UTC, receiving related values.

Regards,
Tobias

Post Reply

Return to “Netatmo API”