thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
219 stars 54 forks source link

Allow units via thin-edge json #982

Open mbay-ODW opened 2 years ago

mbay-ODW commented 2 years ago

Describe the solution you'd like Currently devices can not send unit via the thin-edge json approach. However this is needed for some use cases where the device is actively sending the unit. Describe alternatives you've considered Data point library does work works on platform side, however at some points the unit should come directly from the device itself (e.g. switch mode metric <-> imperial). Additional context

didier-wenzek commented 2 years ago

Is the unit sent along all and every data points? Or is the unit defined as metadata of the measurement source ?

mbie-sag commented 2 years ago

Imo both should be possible.

didier-wenzek commented 2 years ago

There is broader discussion about thin-edge json here https://github.com/thin-edge/thin-edge.io-specs/pull/19

albinsuresh commented 2 years ago

@mbay-SAG @mbie-sag

Is it really useful to send the unit along with each and every measurement? Or you'd rather want the ability to set/update the unit of a measurement (its metadata) either as a static configuration or as a dynamic property? Expecting the unit with every measurement would definitely be the easiest thing to implement. But wouldn't that put unnecessary burden on the end user in terms of wasted bandwidth on every measurement sent?

As an extended query, when a measurement is sent without a unit from the device, what would be the preferred behaviour?

mbay-ODW commented 2 years ago

Currently on C8Y the unit can be send, but is optional. So I would expect that if I pack the unit into my json, that it is used by the mapper. However if not, then not.

How the ui handles that is nothing that is implemented within thin-edge, is it? I personally would prefer that the ui uses the unit from the last measurement where a unit was provided but this seems to be problematic considering retentions etc.