JSON Conversion

  • Platform information:
    • Hardware: Raspberry Pi 3+
    • OS: openhabian
    • Java Runtime Environment: 1.8.0
    • openHAB version: 2.4

Hello,
I’m quite new to Openhab and I really like it. I managed to configure all my stuff working so far, but now I’ve got a problem with a JSON conversion inside the Paper UI configuring a MQTT Thing.

I’m writing on my bachelor thesis and therefor I will set up a Voice control, which works offline and works with mqtt. The aim is to control a philips hue light by the voice control using mqtt. Now as things run, I’ve created a broker bridge (between openhab and the voice control), and I can control my hue lights using the hue2mqtt binding.

The problem I have is, that the voice control sents JSON formatted data, and the hue2mqtt binding can do both, text and JSON formatted data. On the incoming channel I have a JSON object “value”, which is to transfer to the lamp either as plain text or as JSON data as well. Inside the Paper UI I can set up the incoming value transformation, so that I can extract the necessary data, but it wont arrive at the lamp.

I’ve added some screenshots from mqtt.fx and the Paper UI, maybe you can give me some help.

Did you install the JSONPATH transform?

Yes I did, and when I listen to all topics on mqtt.fx, I see the messages go out from the voice control, i added some screenshots now from mqtt.fx.

the term “value” coming on channel “speech/output” is to be sent as text to the channel “hue/set/lights/ecklampe”

This might be the problem. The entire JSON get’s sent to the Channel. Then the JSONPATH transform extracts the one element that you want to have any Item linked to that Channel set to.

You never added any screenshots of your setup and your descriptions are somewhat confusing. Screen shots aren’t terribly useful as they are all but illegible when reading on a phone.

Do you have errors in the logs?

Does the Broker Thing show as online?

Did you create an Item and link it to the Channel?

Yes inside the log I have an error that says “Executing the JSONPATH-transformation failed: Invalid path ‘$.content.slots.value’ in ‘0,0,0’”

The broker is online, and on mqtt.fx I can control my lamp.

So it seems that the thing is not reading from the correct channel. I can add only one picture in one post, sorry. Here is my PaperUI config:

The error is clearly saying that there is something wrong with the JSONPATH. Double check the path with the JSON you are receiving. Are ALL the messages received on this topic of the same format? If some of the messages have a different JSON format you will get an error for each one that doesn’t match the JSONPATH.