Why does API-Rest, when querying, return some values with a few decimal places and others with so much?

Hi all,

When I query the values of a specific item through api rest, sometimes I receive values that seem correct and other very long values that do not seem consistent. Is there any way to determine 3 decimal places? Could it be that I get noise?

Thanks a lot

That’s ordinary enough, all digital numbers are an approximation. The REST just shows you what’s in the Item state, which may been through conversions or calculations, we don’t know.

But that’s why Items have ‘pattern’ metadata, allowing users to specify e.g. number of decimalplaces for display in UI. You’ve bypassed that. Maybe look at displayState

The persistence service is storing data at selectable instances, it looks like you are using an everyMinute strategy ( other posiblietes exist like everyChange, etc…) If the items state changes between those steps the persistence service migth use an aggregation function to calculate the value to be stored ( for example the average of all values received by the service in that timeframe, for example the default setup of rrd4j will receive a value every 10 seconds).
Without knowing which persistence service and with what setup your are using we can only guess the reason for your observed problem.

1 Like

Well spotted, I hadn’t recognised the screenshot as being persistence related.

Thanks for answering @rossko57 @opus.

I have persistence by default and receive measurements every 5 seconds. I hope this information can help.

Greetings and thank you.