Skip to content

Added support for Rain Gauge#1

Merged
philippelt merged 3 commits into
philippelt:masterfrom
asphotographics:master
May 6, 2014
Merged

Added support for Rain Gauge#1
philippelt merged 3 commits into
philippelt:masterfrom
asphotographics:master

Conversation

@asphotographics

Copy link
Copy Markdown
Contributor

Added mapping for Rain measurement in SENSOR_PROPERTIES and updated
usage documentation.

Running samples/printAllLastData outputs:

Rain Gauge
                     rf_status : 60
                    battery_vp : 6402
                          When : 06:39:45
                          Rain : 0
Indoor
                         Noise : 34
                   Temperature : 21.2
                          When : 06:39:53
                      Humidity : 31
                      Pressure : 1035
                           Co2 : 542
Indoor 2
                           Co2 : 468
                     rf_status : 63
                   Temperature : 23
                          When : 06:39:38
                      Humidity : 27
                    battery_vp : 5882
Outdoor
                     rf_status : 59
                    battery_vp : 6132
                          When : 06:39:51
                   Temperature : 0.3
                      Humidity : 61

Added mapping for Rain measurement in SENSOR_PROPERTIES and updated
usage documentation.

Running samples/printAllLastData outputs:
```
Rain Gauge
                     rf_status : 60
                    battery_vp : 6402
                          When : 06:39:45
                          Rain : 0
Indoor
                         Noise : 34
                   Temperature : 21.2
                          When : 06:39:53
                      Humidity : 31
                      Pressure : 1035
                           Co2 : 542
Indoor 2
                           Co2 : 468
                     rf_status : 63
                   Temperature : 23
                          When : 06:39:38
                      Humidity : 27
                    battery_vp : 5882
Outdoor
                     rf_status : 59
                    battery_vp : 6132
                          When : 06:39:51
                   Temperature : 0.3
                      Humidity : 61
```
@philippelt

Copy link
Copy Markdown
Owner

Hello,
thanks for your contribution.

By the way, I wonder if we should add the rain measurement in the lastData call. All other informations are instantaneous values. Rain level doesn't make sense as an instantaneous value, you can only measure the rain quantity that has fallen on a given amount of time and units are not obvious (mm water per square meter or something else ?).

What do you think would be the easiest way to supply the value ? Something like amount of rain in the last hour or day to now ? I don't know what units are available, I received my rain gauge a few days ago but had no time yet to test it.

Have you tested the value in the data store, does-it give the number of ticks detected by the tipping bucket mechanism in the last "sent data" interval or something more "meteorologic" ?

Thanks again for helping

@asphotographics

Copy link
Copy Markdown
Contributor Author

As far as I can see, lastData() is the only place where SENSOR_PROPERTIES is used. My change does fix lastData().

According to Netatmo, the contents of last_data_store is for "internal use only" (http://forum.netatmo.com/viewtopic.php?f=5&t=3113). It doesn’t help that they do include it in their API docs (which are quite thin on details regarding responses).

Regarding the value type of the rain measurements, here is what I have figured out so far...

Netatmo does not store the tick count of the bucket tips. You can calibrate the tipping volume of the buckets and Netatmo use that volume divided by the collection cone area to arrive at a quantity in millimetres. In other words each tip is equal to x mm of rainfall.

The rain gauge seems to sum up the volumes between the times when it records a value to the main device/Netamo's servers. In other words, if the gauge is calibrated at 0.101 mm/tip, and the bucket has tipped 3 times since the last recording, then the next recording will be 0.303.

When you query the API at "max" scale, and request the "Rain" data type, each value returned will be the total millimetres of rain accumulated during that recoding interval (average of about 5 minutes).

When you query the API with other scales (e.g., "1day") and request the "sum_rain" data type, then each value returned will be the sum of rain accumulated over the scale period (e.g., 3.9 mm for 1 day)

I was lucky (unlucky) enough to get rain (mostly snow really) the day after I installed my gauge. Here are the outputs of the API for that day at various scale levels:

max

https://api.netatmo.net/api/getmeasure scale=max&date_begin=1398492000.0&access_token=????&date_end=1398578399.0&real_time=true&module_id=05%3A00%3A00%3A00%3A0d%3Aae&type=Rain&optimize=false&device_id=70%3Aee%3A50%3A02%3Aa8%3A52
{u'body': {u'1398492001': [0],
           u'1398492296': [0],
           u'1398492604': [0],
           u'1398492898': [0],
           u'1398493206': [0],
           u'1398493501': [0],
           u'1398493808': [0],
           u'1398494116': [0],
           u'1398494411': [0],
           u'1398494718': [0],
           u'1398495013': [0],
           u'1398495321': [0],
           u'1398495616': [0],
           u'1398495923': [0],
           u'1398496218': [0],
           u'1398496526': [0],
           u'1398496832': [0],
           u'1398497127': [0],
           u'1398497435': [0],
           u'1398497729': [0],
           u'1398498037': [0],
           u'1398498332': [0],
           u'1398498640': [0],
           u'1398498934': [0],
           u'1398499242': [0],
           u'1398499550': [0],
           u'1398499844': [0],
           u'1398500152': [0],
           u'1398500446': [0],
           u'1398500753': [0],
           u'1398501048': [0],
           u'1398501292': [0],
           u'1398501600': [0],
           u'1398501895': [0],
           u'1398502202': [0],
           u'1398502497': [0],
           u'1398502805': [0],
           u'1398503113': [0],
           u'1398503407': [0],
           u'1398503714': [0],
           u'1398504009': [0],
           u'1398504317': [0],
           u'1398504611': [0],
           u'1398504919': [0],
           u'1398505214': [0],
           u'1398505521': [0],
           u'1398505816': [0],
           u'1398506124': [0],
           u'1398506418': [0],
           u'1398506725': [0],
           u'1398507021': [0],
           u'1398507329': [0],
           u'1398507636': [0],
           u'1398507931': [0],
           u'1398508238': [0],
           u'1398508533': [0],
           u'1398508841': [0],
           u'1398509136': [0],
           u'1398509443': [0],
           u'1398509750': [0],
           u'1398510046': [0],
           u'1398510354': [0],
           u'1398510647': [0],
           u'1398510955': [0],
           u'1398511250': [0],
           u'1398511557': [0],
           u'1398511852': [0],
           u'1398512160': [0],
           u'1398512455': [0],
           u'1398512762': [0],
           u'1398513057': [0],
           u'1398513365': [0],
           u'1398513672': [0],
           u'1398513967': [0],
           u'1398514275': [0],
           u'1398514570': [0],
           u'1398514877': [0],
           u'1398515172': [0],
           u'1398515479': [0],
           u'1398515773': [0],
           u'1398516081': [0],
           u'1398516376': [0],
           u'1398516683': [0],
           u'1398516991': [0],
           u'1398517286': [0],
           u'1398517593': [0],
           u'1398517889': [0],
           u'1398518197': [0],
           u'1398518492': [0],
           u'1398518799': [0],
           u'1398519093': [0],
           u'1398519401': [0],
           u'1398519695': [0],
           u'1398520003': [0],
           u'1398520311': [0],
           u'1398520606': [0],
           u'1398520913': [0],
           u'1398521208': [0],
           u'1398521516': [0],
           u'1398521823': [0],
           u'1398522118': [0],
           u'1398522426': [0],
           u'1398522720': [0],
           u'1398523028': [0],
           u'1398523323': [0],
           u'1398523630': [0],
           u'1398523925': [0],
           u'1398524233': [0],
           u'1398524528': [0],
           u'1398524835': [0],
           u'1398525143': [0],
           u'1398525437': [0],
           u'1398525744': [0],
           u'1398526039': [0],
           u'1398526347': [0],
           u'1398526642': [0],
           u'1398526949': [0],
           u'1398527257': [0],
           u'1398527552': [0],
           u'1398527859': [0],
           u'1398528154': [0],
           u'1398528462': [0],
           u'1398528756': [0],
           u'1398529063': [0],
           u'1398529358': [0],
           u'1398529666': [0],
           u'1398529961': [0],
           u'1398530269': [0.101],
           u'1398530564': [0],
           u'1398530870': [0],
           u'1398531165': [0],
           u'1398531473': [0],
           u'1398531767': [0],
           u'1398532076': [0.101],
           u'1398532371': [0],
           u'1398532677': [0.101],
           u'1398532985': [0],
           u'1398533280': [0],
           u'1398533588': [0],
           u'1398533882': [0],
           u'1398534190': [0.101],
           u'1398534498': [0],
           u'1398534792': [0],
           u'1398535100': [0.101],
           u'1398535395': [0.505],
           u'1398535702': [0.202],
           u'1398535997': [0.303],
           u'1398536305': [0.101],
           u'1398536612': [0.101],
           u'1398536906': [0.101],
           u'1398537214': [0],
           u'1398537510': [0],
           u'1398537817': [0],
           u'1398538111': [0],
           u'1398538419': [0],
           u'1398538713': [0],
           u'1398539021': [0],
           u'1398539329': [0],
           u'1398539624': [0],
           u'1398539931': [0],
           u'1398540226': [0],
           u'1398540534': [0],
           u'1398540828': [0],
           u'1398541135': [0],
           u'1398541430': [0],
           u'1398541738': [0],
           u'1398542033': [0],
           u'1398542341': [0],
           u'1398542648': [0.101],
           u'1398542943': [0],
           u'1398543251': [0],
           u'1398543545': [0],
           u'1398543852': [0.101],
           u'1398544147': [0],
           u'1398544455': [0],
           u'1398544750': [0],
           u'1398545058': [0],
           u'1398545353': [0],
           u'1398545660': [0.101],
           u'1398545954': [0],
           u'1398546262': [0],
           u'1398546557': [0.101],
           u'1398546864': [0],
           u'1398547172': [0],
           u'1398547467': [0],
           u'1398547774': [0],
           u'1398548069': [0],
           u'1398548377': [0],
           u'1398548672': [0.101],
           u'1398548978': [0.101],
           u'1398549273': [0.101],
           u'1398549582': [0],
           u'1398549876': [0.202],
           u'1398550170': [0.101],
           u'1398550478': [0.101],
           u'1398550786': [0.101],
           u'1398551081': [0.101],
           u'1398551388': [0.101],
           u'1398551695': [0],
           u'1398551990': [0.101],
           u'1398552298': [0],
           u'1398552593': [0],
           u'1398552900': [0],
           u'1398553195': [0.101],
           u'1398553503': [0],
           u'1398553798': [0.101],
           u'1398554105': [0],
           u'1398554400': [0],
           u'1398554708': [0.101],
           u'1398555001': [0],
           u'1398555309': [0],
           u'1398555605': [0],
           u'1398555912': [0],
           u'1398556207': [0],
           u'1398556515': [0],
           u'1398556809': [0],
           u'1398557116': [0],
           u'1398557412': [0.101],
           u'1398557720': [0],
           u'1398558014': [0],
           u'1398558309': [0],
           u'1398558617': [0],
           u'1398558912': [0],
           u'1398559219': [0],
           u'1398559514': [0],
           u'1398559821': [0],
           u'1398560128': [0.101],
           u'1398560423': [0],
           u'1398560731': [0],
           u'1398561026': [0],
           u'1398561333': [0],
           u'1398561628': [0],
           u'1398561936': [0],
           u'1398562230': [0],
           u'1398562538': [0],
           u'1398562832': [0],
           u'1398563139': [0],
           u'1398563435': [0],
           u'1398563743': [0],
           u'1398564038': [0],
           u'1398564345': [0],
           u'1398564639': [0],
           u'1398564947': [0],
           u'1398565242': [0],
           u'1398565550': [0],
           u'1398565844': [0],
           u'1398566151': [0],
           u'1398566446': [0],
           u'1398566741': [0],
           u'1398567049': [0],
           u'1398567344': [0],
           u'1398567651': [0],
           u'1398567946': [0],
           u'1398568254': [0],
           u'1398568548': [0],
           u'1398568856': [0],
           u'1398569151': [0],
           u'1398569445': [0],
           u'1398569752': [0],
           u'1398570048': [0],
           u'1398570356': [0],
           u'1398570649': [0],
           u'1398570957': [0],
           u'1398571252': [0],
           u'1398571559': [0],
           u'1398571855': [0],
           u'1398572163': [0],
           u'1398572457': [0],
           u'1398572764': [0],
           u'1398573059': [0],
           u'1398573367': [0],
           u'1398573661': [0],
           u'1398573969': [0],
           u'1398574264': [0],
           u'1398574572': [0],
           u'1398574865': [0],
           u'1398575173': [0.101],
           u'1398575469': [0],
           u'1398575776': [0],
           u'1398576071': [0],
           u'1398576379': [0],
           u'1398576674': [0],
           u'1398576981': [0],
           u'1398577276': [0],
           u'1398577584': [0],
           u'1398577877': [0],
           u'1398578185': [0]},
 u'status': u'ok',
 u'time_exec': 0.013269901275635,
 u'time_server': 1398793933}
2014-04-26 10:37:49 [0.101]
2014-04-26 11:07:56 [0.101]
2014-04-26 11:17:57 [0.101]
2014-04-26 11:43:10 [0.101]
2014-04-26 11:58:20 [0.101]
2014-04-26 12:03:15 [0.505]
2014-04-26 12:08:22 [0.202]
2014-04-26 12:13:17 [0.303]
2014-04-26 12:18:25 [0.101]
2014-04-26 12:23:32 [0.101]
2014-04-26 12:28:26 [0.101]
2014-04-26 14:04:08 [0.101]
2014-04-26 14:24:12 [0.101]
2014-04-26 14:54:20 [0.101]
2014-04-26 15:09:17 [0.101]
2014-04-26 15:44:32 [0.101]
2014-04-26 15:49:38 [0.101]
2014-04-26 15:54:33 [0.101]
2014-04-26 16:04:36 [0.202]
2014-04-26 16:09:30 [0.101]
2014-04-26 16:14:38 [0.101]
2014-04-26 16:19:46 [0.101]
2014-04-26 16:24:41 [0.101]
2014-04-26 16:29:48 [0.101]
2014-04-26 16:39:50 [0.101]
2014-04-26 16:59:55 [0.101]
2014-04-26 17:09:58 [0.101]
2014-04-26 17:25:08 [0.101]
2014-04-26 18:10:12 [0.101]
2014-04-26 18:55:28 [0.101]
2014-04-26 23:06:13 [0.101]

Total = 3.939

30min

https://api.netatmo.net/api/getmeasure scale=30min&date_begin=1398492000.0&access_token=????&date_end=1398578399.0&real_time=true&module_id=05%3A00%3A00%3A00%3A0d%3Aae&type=sum_rain&optimize=false&device_id=70%3Aee%3A50%3A02%3Aa8%3A52
{u'body': {u'1398492000': [0],
           u'1398493800': [0],
           u'1398495600': [0],
           u'1398497400': [0],
           u'1398499200': [0],
           u'1398501000': [0],
           u'1398502800': [0],
           u'1398504600': [0],
           u'1398506400': [0],
           u'1398508200': [0],
           u'1398510000': [0],
           u'1398511800': [0],
           u'1398513600': [0],
           u'1398515400': [0],
           u'1398517200': [0],
           u'1398519000': [0],
           u'1398520800': [0],
           u'1398522600': [0],
           u'1398524400': [0],
           u'1398526200': [0],
           u'1398528000': [0],
           u'1398529800': [0.10104250200481],
           u'1398531600': [0.20208500400962],
           u'1398533400': [0.20208500400962],
           u'1398535200': [1.3135525260626],
           u'1398537000': [0],
           u'1398538800': [0],
           u'1398540600': [0],
           u'1398542400': [0.20208500400962],
           u'1398544200': [0.10104250200481],
           u'1398546000': [0.10104250200481],
           u'1398547800': [0.30312750601443],
           u'1398549600': [0.70729751403368],
           u'1398551400': [0.20208500400962],
           u'1398553200': [0.20208500400962],
           u'1398555000': [0],
           u'1398556800': [0.10104250200481],
           u'1398558600': [0.10104250200481],
           u'1398560400': [0],
           u'1398562200': [0],
           u'1398564000': [0],
           u'1398565800': [0],
           u'1398567600': [0],
           u'1398569400': [0],
           u'1398571200': [0],
           u'1398573000': [0],
           u'1398574800': [0.10104250200481],
           u'1398576600': [0]},
 u'status': u'ok',
 u'time_exec': 0.01377010345459,
 u'time_server': 1398793934}
2014-04-26 10:30:00 [0.10104250200481]
2014-04-26 11:00:00 [0.20208500400962]
2014-04-26 11:30:00 [0.20208500400962]
2014-04-26 12:00:00 [1.3135525260626]
2014-04-26 14:00:00 [0.20208500400962]
2014-04-26 14:30:00 [0.10104250200481]
2014-04-26 15:00:00 [0.10104250200481]
2014-04-26 15:30:00 [0.30312750601443]
2014-04-26 16:00:00 [0.70729751403368]
2014-04-26 16:30:00 [0.20208500400962]
2014-04-26 17:00:00 [0.20208500400962]
2014-04-26 18:00:00 [0.10104250200481]
2014-04-26 18:30:00 [0.10104250200481]
2014-04-26 23:00:00 [0.10104250200481]

Total = 3.94065757819

1hour

https://api.netatmo.net/api/getmeasure scale=1hour&date_begin=1398492000.0&access_token=????&date_end=1398578399.0&real_time=true&module_id=05%3A00%3A00%3A00%3A0d%3Aae&type=sum_rain&optimize=false&device_id=70%3Aee%3A50%3A02%3Aa8%3A52
{u'body': {u'1398492000': [0],
           u'1398495600': [0],
           u'1398499200': [0],
           u'1398502800': [0],
           u'1398506400': [0],
           u'1398510000': [0],
           u'1398513600': [0],
           u'1398517200': [0],
           u'1398520800': [0],
           u'1398524400': [0],
           u'1398528000': [0.10104250200481],
           u'1398531600': [0.40417000801925],
           u'1398535200': [1.3135525260626],
           u'1398538800': [0],
           u'1398542400': [0.30312750601443],
           u'1398546000': [0.40417000801925],
           u'1398549600': [0.9093825180433],
           u'1398553200': [0.20208500400962],
           u'1398556800': [0.20208500400962],
           u'1398560400': [0],
           u'1398564000': [0],
           u'1398567600': [0],
           u'1398571200': [0],
           u'1398574800': [0.10104250200481]},
 u'status': u'ok',
 u'time_exec': 0.51777005195618,
 u'time_server': 1398793935}
2014-04-26 10:00:00 [0.10104250200481]
2014-04-26 11:00:00 [0.40417000801925]
2014-04-26 12:00:00 [1.3135525260626]
2014-04-26 14:00:00 [0.30312750601443]
2014-04-26 15:00:00 [0.40417000801925]
2014-04-26 16:00:00 [0.9093825180433]
2014-04-26 17:00:00 [0.20208500400962]
2014-04-26 18:00:00 [0.20208500400962]
2014-04-26 23:00:00 [0.10104250200481]

Total = 3.94065757819

3hours

https://api.netatmo.net/api/getmeasure scale=3hours&date_begin=1398492000.0&access_token=????&date_end=1398578399.0&real_time=true&module_id=05%3A00%3A00%3A00%3A0d%3Aae&type=sum_rain&optimize=false&device_id=70%3Aee%3A50%3A02%3Aa8%3A52
{u'body': {u'1398492000': [0],
           u'1398502800': [0],
           u'1398513600': [0],
           u'1398524400': [0.50521251002406],
           u'1398535200': [1.616680032077],
           u'1398546000': [1.5156375300722],
           u'1398556800': [0.20208500400962],
           u'1398567600': [0.10104250200481]},
 u'status': u'ok',
 u'time_exec': 0.87954187393188,
 u'time_server': 1398793936}
2014-04-26 09:00:00 [0.50521251002406]
2014-04-26 12:00:00 [1.616680032077]
2014-04-26 15:00:00 [1.5156375300722]
2014-04-26 18:00:00 [0.20208500400962]
2014-04-26 21:00:00 [0.10104250200481]

Total = 3.94065757819

1day

https://api.netatmo.net/api/getmeasure scale=1day&date_begin=1398492000.0&access_token=????&date_end=1398578399.0&real_time=true&module_id=05%3A00%3A00%3A00%3A0d%3Aae&type=sum_rain&optimize=false&device_id=70%3Aee%3A50%3A02%3Aa8%3A52
{u'body': {u'1398492000': [3.9]},
 u'status': u'ok',
 u'time_exec': 0.0066909790039062,
 u'time_server': 1398793938}
2014-04-26 00:00:00 [3.9]

Total = 3.9

By default, for scales other than max, the timestamp of values is
offset by +scale/2. For example, for a scale of 1day the times amps
will be at noon. The real_time causes the timestamp to be the beginning
of the period. Setting realtime to True keeps the timestamp from
potentially exceeding date_end.
@asphotographics

Copy link
Copy Markdown
Contributor Author

Just added another small change. Looks like Netatmo have added a new real_time argument to getMeasure(). I added this to the library. I thought I would be able to do a separated pull request, but I guess I would need to branch for that to work. New to GitHub.

@philippelt

Copy link
Copy Markdown
Owner

Hello,

sorry for the delay, my bread and butter activity is frequently overloading my agenda these times and, unfortunately, this is rather good news.

Still not had time to install my rain gauge.

Thanks a lot for your inputs. I understand that the system is counting bucket ticks and compute a water volume with an adjustment factor.

It means that, when you read an instant value, you juste have the volume of water that has been counted since the previous data sent which is a time interval not clearly defined (unless the software is continuously monitoring the sensor which is not the idea).

I suggest we rather supply volume of water received in specific period of time : last hour, from start of the day, for last slipping 24h for example. That mean a new dedicated method of deviceList (something like getRainLevel(station, interval) using keyword as interval).

As a gadget, we could had a function to tell wether it is raining or not (based on any water received in the last 20 minutes that should give two samples), something like deviceList.isRaining(station) returning True or False.

We could assumed that there is only one rain gauge per station to ease usage (do you agree ?)

Regards
Phil

Le 29 avr. 2014 à 20:36, asphotographics [email protected] a écrit :

Just added another small change. Looks like Netatmo have added a new real_time argument to getMeasure(). I added this to the library. I thought I would be able to do a separated pull request, but I guess I would need to branch for that to work. New to GitHub.


Reply to this email directly or view it on GitHub.

@asphotographics

Copy link
Copy Markdown
Contributor Author

For my purposes I only need to get the log data from Netatmo. I will be doing all my calculations outside the API. Do you intend for lnetatmo.py to simply be an interface to the API, or do you think it should contain more helpful calculations?

Not all station measurements are instant values. Noise/sound, for example is “the average noise level (in dB) over five minute interval”, according to Netatmo FAQs. I do suspect that the sound average is really over the recoding interval, which in my experience averages about 5 minutes, +/- a few seconds.

But an average over a period is different from a sum.

The question is, if I get two rain measurements from the API, one of 2 mm and one of 2.3 mm, how do I know that the 2.3 mm is due to an increase in the rate of rain and not simply a longer sampling interval (say 5:03 vs 4:57). It is a legitimate concern.

From the max scale, one could simply compare the timestamps for the samples in question to calculate the average rain rate to 1 second of accuracy. This would smooth out any increases/decreases in rain rate due to interval length variation.

Seconds since last mm mm/second 5 minute average
300 2.0 0.00667 2.001
297 2.0 0.00673 2.019
306 2.0 0.00653 1.959
360 2.4 0.00667 2.001

I think these mock numbers demonstrate that even for very heavy rain (24 mm/h) if the recording interval is +/- only a few seconds then the calculated rain rate for a 5 minute period only varies by less than a 0.1 mm. I think that is pushing the accuracy of the gauge (you would have to have a very accurate calibration). However, if for some reason the interval varies +/- a minute or more, then yes, a calculation accounting for that variation could be useful, perhaps a new helper method as you suggest.

I think one does not know why the recoding interval might be extraordinarily long. Perhaps the gauge was not sampling during the entire time because it was rebooting for a few of those seconds (faulty batteries maybe)? Who knows.

For anything other than the max scale, I think the API already provides what you are looking for — a sum of rain volume over time. I wouldn’t duplicate that functionality with a separate method. (Though an argument could be made that you still don’t know that exact length of the interval — a 1day summation might actually include samples from 0:00:03 to 23:59:47 one day and 0:00:01 to 23:59:59 the next — but the larger the scale, the less meaningful those few extra seconds at the beginning or end of the period.)

Tipping bucket rain gauges are convenient but not perfect. They tend to under report the volume of rain. If rain partially fills a bucket and then stops, then that volume will not be reported until it starts to rain again, maybe hours later (or more likely never as the water will probably evaporate). So far the Netatmo rain gauge has tracked the forecast to within ~0.5 mm per day (haven’t compared it to other stations yet, or done a calibration) even when the precipitation has mainly been in the form of wet snow :(

@philippelt

Copy link
Copy Markdown
Owner

Your remark about noise being averaged was an interesting point I was not aware off. I thought it was the "instant" measurement that would be possible but with a risk of error due to the relative small size of the sampling (1 point in ms over 5 minutes).

I have noticed the 5 minutes pool. But I have seen exception in the network traffic (probably due to migration or downtime of netatmo servers or dns load balancing delay).

You are true that this library should stay a simple access to netatmo official library (despite the fact that netatmo refuse to endorse the use of last data store).

As far as I have seen (done some network listening to study the protocol between the station and the netatmo server), the time interval is quite stable (at least to a few seconds resolution which is far enough as you said) and the major risk is a sample to be cancelled. The measurement interval for this point then switch from 5 minutes to 10 minutes and a cumulative value would then double !

I suppose this is a reason why netatmo upload the sample time with each sample measurement. They probably correct the value according with the real interval reported.

Considering that these are rare events, we will stay with your proposal.

The units of the value will be "mm of water fallen during the last 5 minutes"...

Can you adjust your change in usage to add a note that specify this unit and I will be able to commit your changes.

Thanks for your contribution

Philippe

Le 5 mai 2014 à 16:47, asphotographics [email protected] a écrit :

For my purposes I only need to get the log data from Netatmo. I will be doing all my calculations outside the API. Do you intend for lnetatmo.py to simply be an interface to the API, or do you think it should contain more helpful calculations?

Not all station measurements are instant values. Noise/sound, for example is “the average noise level (in dB) over five minute interval”, according to Netatmo FAQs. I do suspect that the sound average is really over the recoding interval, which in my experience averages about 5 minutes, +/- a few seconds.

But an average over a period is different from a sum.

The question is, if I get two rain measurements from the API, one of 2 mm and one of 2.3 mm, how do I know that the 2.3 mm is due to an increase in the rate of rain and not simply a longer sampling interval (say 5:03 vs 4:57). It is a legitimate concern.

From the max scale, one could simply compare the timestamps for the samples in question to calculate the average rain rate to 1 second of accuracy. This would smooth out any increases/decreases in rain rate due to interval length variation.

Seconds since last mm mm/second 5 minute average
300 2.0 0.00667 2.001
297 2.0 0.00673 2.019
306 2.0 0.00653 1.959
360 2.4 0.00667 2.001
I think these mock numbers demonstrate that even for very heavy rain (24 mm/h) if the recording interval is +/- only a few seconds then the calculated rain rate for a 5 minute period only varies by less than a 0.1 mm. I think that is pushing the accuracy of the gauge (you would have to have a very accurate calibration). However, if for some reason the interval varies +/- a minute or more, then yes, a calculation accounting for that variation could be useful, perhaps a new helper method as you suggest.

I think one does not know why the recoding interval might be extraordinarily long. Perhaps the gauge was not sampling during the entire time because it was rebooting for a few of those seconds (faulty batteries maybe)? Who knows.

For anything other than the max scale, I think the API already provides what you are looking for — a sum of rain volume over time. I wouldn’t duplicate that functionality with a separate method. (Though an argument could be made that you still don’t know that exact length of the interval — a 1day summation might actually include samples from 0:00:03 to 23:59:47 one day and 0:00:01 to 23:59:59 the next — but the larger the scale, the less meaningful those few extra seconds at the beginning or end of the period.)

Tipping bucket rain gauges are convenient but not perfect. They tend to under report the volume of rain. If rain partially fills a bucket and then stops, then that volume will not be reported until it starts to rain again, maybe hours later (or more likely never as the water will probably evaporate). So far the Netatmo rain gauge has tracked the forecast to within ~0.5 mm per day (haven’t compared it to other stations yet, or done a calibration) even when the precipitation has mainly been in the form of wet snow :(


Reply to this email directly or view it on GitHub.

Added information about unit-of-measure for Rain in lastData method.
@asphotographics

Copy link
Copy Markdown
Contributor Author

Change to usage.md done.

Cheers,
Aaron

philippelt added a commit that referenced this pull request May 6, 2014
Added support for Rain Gauge
@philippelt
philippelt merged commit 0448040 into philippelt:master May 6, 2014
@philippelt

Copy link
Copy Markdown
Owner

Thanks for your work.
You may post a topic in the API forum to inform others of this change...

You may have not noticed that netatmo just changed the last_data_store structure without backward compatibility !
No big deal, I published a fix today.

Cheers
Phil

Le 6 mai 2014 à 16:38, asphotographics [email protected] a écrit :

Change to usage.md done.

Cheers,
Aaron


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants