bochove / nl.bochove.knmi

Homey app to fetch knmi weather data up to 300 times a day.
GNU General Public License v3.0
1 stars 2 forks source link

Mixed up API parameters #3

Closed DirkdeDraak closed 3 years ago

DirkdeDraak commented 3 years ago

Great that you created this App for Homey. At first I had implemented this via a HTTP Request card, but this is much nicer! I use it to control things like my sunscreens.

I noticed that the "WindForce" is showing 11.7 for my city, which struck me as odd, while we don't have hurricanes here in NL...

It seems in your code you mixed up two API parameters: winds and windk or you skipped to include winds. winds is WindForce in Beaufort (Bft) windk is WindForce in Knots (kn or kt) See https://weerlive.nl/delen.php#tab2

See the following lines in your code https://github.com/bochove/nl.bochove.knmi/blob/master/app.js#L29 https://github.com/bochove/nl.bochove.knmi/blob/master/app.js#L41 https://github.com/bochove/nl.bochove.knmi/blob/master/app.js#L50 https://github.com/bochove/nl.bochove.knmi/blob/master/app.js#L60 https://github.com/bochove/nl.bochove.knmi/blob/master/app.js#L61

Kindly change WindForce to the winds value and possibly add a WindForce_kn for windk.

Thank you!

bochove commented 3 years ago

I fixed that mixup, not sure when I will get around to testing and publishing though.

About wind speed in knots: We have wind force, wind speed in KMH, wind speed in meters per second and then also add wind speed in knots? I figured that was a bit much since this app already has so many variables. I figured it was best to skip one of these. I don't think it will be missed much.

I mean, I could in theory also provide wind speed in miles per hour and feet feet per second. I don't think all possible scales should be added, if anyone uses those scales they can convert them manually before using them in a flow. Nautical miles per hour (knots) and Homey don't look like they would be used a lot together anyways, just as miles per hour and feet per second are not likely to be used for flows with this app that is targeting the weather in the Netherlands.

In fact I was tempted to also skip wind speed in meters per second for that reason.

DirkdeDraak commented 3 years ago

The Weerlive parameters are not that consistent in their naming:

So only for the current windspeed there is a "knots" value: windk. Meaning only Line 29 of app.js needs an update/fix and drivers/knmi/device.js Line 136

Personally I'm not interested in "knots", much more in the correct Beaufort value, while that is what makes sense (to me at least, while the various weather updates on tv use Bft)

I would simply pass thru existing parameter values. People can then adjust to another metric.

bochove commented 3 years ago

@DirkdeDraak Is https://homey.app/nl-nl/app/nl.bochove.knmi/KNMI-(Nederland)/test/ now working as it should be?

P.S. I moved the weerlive things to it's own function: https://github.com/bochove/nl.bochove.knmi/blob/wind_direction_in_degrees/assets/weerlive.js

DirkdeDraak commented 3 years ago

@DirkdeDraak Is https://homey.app/nl-nl/app/nl.bochove.knmi/KNMI-(Nederland)/test/ now working as it should be?

@bochove all values from the weerlive JSON match with what is shown in my KNMI device. So yes, I can confirm it is working as it should.

Though what is weird is that if I tap on the various values I see the time it was last changed. Many of them show 3 hours, 19 hours or even 3 days ago. I would guess these values change more often than that and so I would suspect to see times that are less than 5 minutes, while that is most likely the interval you use to collect the data.

image

Maybe a nice addition would be a time component so you can see when the last update has been retrieved.