Page 1 of 1

Netatmo Rain Meter 24 hours vs daily values

Posted: Tuesday 11 May 2021 15:27
by ccaru
Hi All,

just wondering if anybody could give me the best approach for the following:

I am working on a LUA script to read off the Netatmo API.
The Netatmo API gives a value which is Rain for the past 24 hours, hence a rolling value.

I thought I had it right, but after cross checking the past few days I realised that in many cases I am getting two consecutive days with the same rain value.

The Domoticz counter seems to require a reset at the end of the day - so if I understsand correctly, the cumulative value should be zero at midnight?

Which would be the best and most robust way (including accounting for crashes and reboots, if possible) to convert a rolling value such as this to one which can be accepted by Domoticz?

thanks!

Re: Netatmo Rain Meter 24 hours vs daily values

Posted: Friday 21 May 2021 8:22
by ccaru
OK so this is driving me a bit nuts. After various unsuccessful attempts I tried the following test script, triggering every minute, to simulate 1mm of rain every minute into the counter:

dz.devices(2344).updateRain(1*100, dz.devices(2344).rain + 1) (where 2344 is a virtual Rain Counter)

The first day, all went as expected. I was getting 60mm logged every hour.
Then when the day changed, I started getting a value which I cannot make out:

{
"d" : "2021-05-20 23:00",
"mm" : "60.0"
},
{
"d" : "2021-05-21 00:00",
"mm" : "60.0"
},
{
"d" : "2021-05-21 01:00",
"mm" : "142346.0"
},
{
"d" : "2021-05-21 02:00",
"mm" : "163200.0"
},
{
"d" : "2021-05-21 03:00",
"mm" : "163200.0"
},


I cannot understand the logic behind it. The cumulative value for day 1 happened to be 908 (from when I started the date until midnight, which correctly corresponds to the 908 minutes that passed between when I started the test and midnight). This also got logged properly in the "Day" value in Day 1. What happened both at midnight and at 1am to give values of 142346 and subsequently 163200 I don't understand. Can anybody shed some light?

Claude