LordMike / MBW.BlueRiiot2MQTT

Utility to map between Blue Riiots pool API, and Home Assistant MQTT
49 stars 2 forks source link

Decimal places #10

Closed ggggh closed 4 years ago

ggggh commented 4 years ago

Not as much an issue, rather a possible improvement.

I noticed that the graph on the official app actually seems to plot points with seemingly the same value sometimes slightly differently, which would imply it works internally with more than 1 decimal place precision. I originally thought it was just rounding the plotted curve based on trend, but I don't think so anymore, based on some examples I've seen. Sometimes the last few values may show a seemingly stable ph 7.3 but one of them is plotted slightly higher than the other. Is there any way we can get those back on the API? I doubt we get real 2 decimal accuracy, but at least may help identify trends faster, or avoid false trend perception on a value toggling +-0.1 alternatively by being rounded up or down on a 0.01 change

LordMike commented 4 years ago

For sure, if the B2M app is changing a 7.3 to 7.2999999999 .. it would suck. I'm using float's to represent those values, and it could happen there.

Would it be possible to pull the values from HASS to see if it bounces back and forth?

LordMike commented 4 years ago

I've checked my data for the last 30 days, and I couldn't spot a value with more than 1 decimal. So I'd really like to see it happen, so I might guess at where the flaw would be.

ggggh commented 4 years ago

This is what I meant on the official app. Selected point is 7.1 - which isn´t centered at the correct Y value, but could just be due to an intentional smoothing of the plotting. But, the next 4 values are all marked as 7.0 on the tooltip, although they clearly are changing (especially noticeable on the last one).

Maybe internally they hold 2 decimals and use that for the plotting, but only expose 1 decimal in HTTP requests other than those used for the graph on the app? If not, they're doing some vary weird smoothing on the plots.

image

LordMike commented 4 years ago

That is weird.. It certainly seems like they're plotting more details, than what the API is surfacing. I've checked my own app and I'm seeing the same..

I'm fairly confident that the API doesn't give more than one decimal point - buut, now that I have more data, I could take a look again.

If the API doesn't provide 2+ decimals, then it has to be the app that is doing stuff..

ggggh commented 4 years ago

How is the graph formed in the app? Is there maybe a specific api it uses for the graph data and which we could use, instead of the api for the current data?

ggggh commented 4 years ago

Just noticed you can actually pinch and zoom on the app and it is much more evident they are plotting with more than one decimal place precision

LordMike commented 4 years ago

I wouldn't know. I only intercepted just enough to be able to get the current measurements. The historical data (which there was something for) isn't something I've looked into.