I want to communicate various sensor data in a network of sensors.
I found MQTT and MQTT-SN as suitable protocols for that. The latter being better suited for sensor networks with support for sleeping devices, predefined communication, alternatives to TCP, etc. (https://stackoverflow.com/a/29083422)
However, both are payload agnostic. The message sent can be of arbitrary format and content. Is there a common format specifically for sensor data with small footprint?
I'd like to communicate a measurement value of a specified unit and dimensionality. Maybe with a specified tolerance/expected error. I could come up with a custom format and just shove it into the payload, but I do not want to reinvent the wheel and rather use existing formats if any exist. That would also ensure compatibility to other networks that use this format.
an experimental proposal for an extension to XMPP which supports things like
Timestamp. However, the overhead of the format being XML based makes it undesirable for my application.
<message email@example.com' firstname.lastname@example.org/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'> <node nodeId='Device01'> <timestamp value='2013-03-07T16:24:30'> <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/> </timestamp> </node> </fields> </message>
Home Assistant, which specifies a format that also has
value_template. But this is more about extracting data from arbitrary MQTT messages into a format of the platform instead of specifying a format for the MQTT message itself. In fact, people write extensions to use JSON in the MQTT message
Is there simply no such thing as a standard (or at least common) lightweight message format for sensor data?