johnwalicki / node-red-contrib-twc-weather

Node-RED nodes for The Weather Company and Weather Underground Personal Weather Station APIs
Apache License 2.0
10 stars 11 forks source link

numericPrecision option added to pws-current files #10

Closed jimison closed 2 years ago

jimison commented 2 years ago

Per issue #8, added numericPrecision option to allow decimal results for various values returned by the API request.

johnwalicki commented 2 years ago

@jimison - this patch looks great. Thank you!

I'm testing it. Re-reading the docs at https://ibm.co/v2PWSCC

What is your use case for extra precision?

johnwalicki commented 2 years ago

Valid Parameter Definitions

Parameter Name | Valid Parameter Value | Description -- | -- | -- numericPrecision | decimal | Optional parameter.  Set to ‘decimal’ to ensure data is returned in decimal format when needed.  Will return integers if this value is not used.
jimison commented 2 years ago

I'm comparing temperatures from various sources, including RPi's and DB18S20 sensors (https://datasheets.maximintegrated.com/en/ds/DS18S20.pdf) for actionable events and notifications. I want the extra precision as long as there's not a polling time trade-off. This API is super handy since my Weather Station posts updates every 5 seconds.

On Mon, Mar 28, 2022 at 9:53 AM John Walicki @.***> wrote:

@jimison https://github.com/jimison - this patch looks great. Thank you!

I'm testing it. Re-reading the docs at https://ibm.co/v2PWSCC

What is your use case for extra precision?

— Reply to this email directly, view it on GitHub https://github.com/johnwalicki/node-red-contrib-twc-weather/pull/10#issuecomment-1080823892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVUISTSD7MU552GDE5UD23VCHIXTANCNFSM5RZPWUMQ . You are receiving this because you were mentioned.Message ID: @.***>

johnwalicki commented 2 years ago

Without &numericPrecision=decimal

{"temp":-1,"heatIndex":-1,"dewpt":-17,"windChill":-6,"windSpeed":14,"windGust":18,"pressure":998.71,"precipRate":0,"precipTotal":0,"elev":37}

With &numericPrecision=decimal

{"temp":-1.2,"heatIndex":-1.2,"dewpt":-16.2,"windChill":-3.9,"windSpeed":7.2,"windGust":11.1,"pressure":998.92,"precipRate":0,"precipTotal":0,"elev":36.9}
johnwalicki commented 2 years ago

Thanks for reading the TWC docs and adding this optional parameter. Merging the PR I will update the changelog, spin a new release, push it to NPM. Good reason to rebase any outdated dependencies too.

johnwalicki commented 2 years ago

@jimison - I am testing v0.5.0 before I npm publish I am not seeing the expected behavior of msg.twcparams.precision overriding the node edit properties. Holding on the release until I can debug some more.

johnwalicki commented 2 years ago

I've got a fix.

johnwalicki commented 2 years ago

node-red-contrib-twc-weather:0.5.0 is available on npm

jimison commented 2 years ago

Up and running. 😎

On Mon, Mar 28, 2022 at 12:29 PM John Walicki @.***> wrote:

node-red-contrib-twc-weather:0.5.0 is available on npm

— Reply to this email directly, view it on GitHub https://github.com/johnwalicki/node-red-contrib-twc-weather/pull/10#issuecomment-1080998354, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVUISRNJ2SWRCZGSRKMBHLVCH3BXANCNFSM5RZPWUMQ . You are receiving this because you were mentioned.Message ID: @.***>