Decoding SenML

  • Platform information:
    • Hardware: virtual machine on Windows 10
    • OS: Ubuntu server 20.04
    • Java Runtime Environment: Zulu 8.46
    • openHAB version: openHABian 2.5.5

Hello there,

Lately I’m playing with some esp32 LoRaWAN boards for a little project where we keep track on how far a sprinkler reel is for on a farm. I have the LoRa part working.

I use the KPN things network to get the LoRa data to my MQTT server. This data exist out of SenML JSON format. Because of my experience with openHAB I thought it would be a good idea to use openHAB and openHABcloud to keep track of my data and send me massages if the reel is X% in.

SenML specification:

I made a little test in python to decode my data with the help of a library. This work partly bud it would be a lot of work to make an android app of some kind with python and it wouldn’t be very expendable. (I have a lot of other ideas involving LoRaWAN)

My coding skills in general are intermediate.
I’m a beginner in java.

My question:
I couldn’t find much about SenML and java and even less about openHAB and SenML. Is there here someone who have a little experience with SenML and openHAB who can help me with creating a decoder?

A MQTT payload look something like this:

Location data:


And my own data:


Thank you in advance.


JSON is JSON. The JSONPATH transformation should work with this just fine, unless the order of the entries in the array is not defined (e.g. locTime might be at some other location than the end). If that’s the case you might need to pull the raw JSON into a Rule to parse it or use the REGEX Transformation.

If you use Scripted Automation with Python or JavaScript there are libraries readily available to parse JSON.