Skip to content

Use floats for values to improve granularity when graphing#93

Closed
ajlennon wants to merge 2 commits into
pimoroni:masterfrom
DynamicDevices:master
Closed

Use floats for values to improve granularity when graphing#93
ajlennon wants to merge 2 commits into
pimoroni:masterfrom
DynamicDevices:master

Conversation

@ajlennon
Copy link
Copy Markdown

No description provided.

Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
@Gadgetoid
Copy link
Copy Markdown
Member

Thank you. And, uh, sorry I know I'm a year late on the mark here.

There's definitely some considerations to be made here, but it needs some more thought about the precision of these values.

float could probably be dropped in most cases, since these values will already be implicitly float (eg: data.oxidising / 1000), or implicitly int where float will add no extra granularity anyway.

round(float(bme280.get_pressure() * 100), -1 ) is also self defeating, since round(N, -1) will round that float down to the nearest ten anyway, eg:

>>> round(24.5, -1)
20.0

I didn't know about mqtt's retain feature. TIL!

@Gadgetoid Gadgetoid closed this Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants