siku2 / hass-weatherlink

Home Assistant integration for Davis Instruments' WeatherLink and AirLink
MIT License
27 stars 7 forks source link

Allow for user-selection of rounding #5

Closed MichaelNMaggs closed 3 years ago

MichaelNMaggs commented 3 years ago

Hi, the integration's working really so far. One rather big issue I've come across, though, is that the hard-coded rounding of results makes it almost impossible to use the integration for detailed charting and analysis. Which is my real purpose here!

To take one example, the Vantage Pro pressure sensor provides readings to a precision of 0.01 hPa, but the integration rounds that to the nearest 1HPa. This is what the raw pressure data looks like over the last few hours (ending with a value of 1020.55):

Screenshot 2021-05-27 at 21 03 48

and this is what the same data looks like when fed through the integration (ending with a rounded final value of 1021):

Screenshot 2021-05-27 at 21 04 59

Would it be possible to allow the user to select the level of rounding for each output separately, please, and also to use the raw (unrounded) values? A separate user-option per output would, I think, be needed as different users will want to graph different things - and a higher level of rounding may be convenient when the user wants simply to display a current value, rather than to track it over time.

Michael

siku2 commented 3 years ago

Would it be possible to allow the user to select the level of rounding for each output separately

Yes. I even designed the code to allow for this, I was just too lazy (read: my time is limited) to implement it. I wasn't a big fan of losing the precision either, but I primarily wrote this integration for a friend who wanted to have the values rounded.

and also to use the raw (unrounded) values?

I can add this as an option too. Just know that the WeatherLink doesn't do a great job of cleaning up the raw values - they still contain "noise" that definitely doesn't correspond to measured data.

siku2 commented 3 years ago

Just released 0.4.0 which allows you to configure the measurement rounding including turning it off entirely.