Page 1 of 1

updateRain(rate, counter) error

Posted: Saturday 09 May 2020 9:53
by Number8
Hello,
It is my understanding that updateRain(rate, counter) documentation should be : updateRain(rate*100, counter) as its JSON equivalent . However the data sent do InfluxDB should be divided by 100 to get the correct display. Am I correct?
dzVents 3.04

Re: updateRain(rate, counter) error

Posted: Saturday 09 May 2020 10:01
by waaren
Number8 wrote: Saturday 09 May 2020 9:53 Hello,
It is my understanding that updateRain(rate, counter) documentation should be : updateRain(rate*100, counter) as its JSON equivalent . However the data sent do InfluxDB should be divided by 100 to get the correct display. Am I correct?
It all depends where you get your rain rate value from. You are in control in what you send. If you want to muliply your source value with a factor that's ok.

Re: updateRain(rate, counter) error

Posted: Saturday 09 May 2020 18:08
by Number8
My understanding is that documentation as it is written for the JSON API should define what unit is expected, and in that case milliliters x 100, or whatever unit

Re: updateRain(rate, counter) error

Posted: Saturday 09 May 2020 20:08
by waaren
Number8 wrote: Saturday 09 May 2020 18:08 My understanding is that documentation as it is written for the JSON API should define what unit is expected, and in that case milliliters x 100, or whatever unit
Let me try to put it in other words.
Assume you get from an external source the rain rate with a value of 0.8. In it self that does not provide you with enough information to do something useful with it. If you would know that this number represents 0.8 mm of rain in the last hour you would have to use 80 as rate in the method updateRain()
But if your weather station defines this value as 0.8 cm during the last day, the rate you would have to enter in updateRain() is 33.3 ( 10 * 100 * 0.8 / 24 )

So the unit definition of your source determines the factor you have to use in updateRain

Re: updateRain(rate, counter) error

Posted: Sunday 10 May 2020 7:20
by Number8
Thanks waaren, but may I say that I respectfully disagree. What I’m saying is: no matter what the raw data is, the rain rate widget displays data in mm/h. And to get it correctly displayed you have to multiply the value you have in mm/hr by 100. This is well documented in the JSON api. Then, of course depending on your raw data you have to do the math accordingly. But at the end, when you get your data in mm/h you have to apply *100. To me the documentation should reflect that. Even more, the documentation, which by the way is a real masterpiece, should define what unit is involved for each updated data. Same issue with Windspeed and Windgust where a *10 factor has to be applied.

Re: updateRain(rate, counter) error

Posted: Sunday 10 May 2020 12:10
by waaren
Number8 wrote: Sunday 10 May 2020 7:20 Even more, the documentation, which by the way is a real masterpiece, should define what unit is involved for each updated data. Same issue with Windspeed and Windgust where a *10 factor has to be applied.
Thanks for the complement on the documentation. All credits are for @dannyBloe

From what I understand of your posts we use different words but are telling the same. Probably a language thing.
I will have another look at the documentation and make the units to be used / returned more explicit where possible. Hopefully you can help with by pointing at other methods / functions where this would be applicable. You can send them using PM

When you use the windUpdate method you don't need a factor. The unit to be used is m/sec. The underlying factor is applied in dzVents' device-adapter wind_device.lua

Re: updateRain(rate, counter) error  [Solved]

Posted: Monday 11 May 2020 10:20
by Number8
From what I understand of your posts we use different words but are telling the same. Probably a language thing.
You may be right ;)

Code: Select all

When you use the windUpdate method you don't need a factor. The unit to be used is m/sec. The underlying factor is applied in dzVents' device-adapter wind_device.lua
I agree. I checked in the meantime, and indeed dzvents does the math.

Code: Select all

Hopefully you can help with by pointing at other methods
With pleasure. So far, as a matter of fact, the only function I had to do that is precipRate. In case the dzvents function is modified, please let us now.