Openhab 3.4.4 // jsonpath transformation... :( can't make it work)

  • Platform information:
    • Hardware: VMware under synology
    • OS: Debian 12
  • Issue of the topic:
    I have around 80 shelly in my house and I am migrating one by one from OH2.4 to OH3.
    => I bind them trough MQTT and I am stuck creating a channel showing the IP address of the devices.

This is the CODE of the thing and I try to transform a JSON message…

UID: mqtt:topic:def72de12d:y25_eg_garag_zip_0wzseite
label: Zip WZ Seitentüre
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:def72de12d
location: WZ
channels:

  • id: ZipWZSeiteCommand
    channelTypeUID: mqtt:rollershutter
    label: Zip-WZ-Seite-Command
    description: “”
    configuration:
    commandTopic: shellies/y25_eg_garag_zip_0wzseite/roller/0/command
    stop: stop
    stateTopic: shellies/y25_eg_garag_zip_0wzseite/roller/0
    off: open
    on: close
  • id: ZipWZSeiteCommandPos
    channelTypeUID: mqtt:dimmer
    label: Zip-WZ-Seite-CommandPos
    description: “”
    configuration:
    min: 0
    qos: 2
    max: 100
    commandTopic: shellies/y25_eg_garag_zip_0wzseite/roller/0/command/pos
    inverted: “true”
    stateTopic: shellies/y25_eg_garag_zip_0wzseite/roller/0/pos
    off: “0”
    on: “100”
  • id: y25_eg_garag_zip_0wzseite_ip
    channelTypeUID: mqtt:string
    label: y25_eg_garag_zip_0wzseite_ip
    description: “”
    configuration:
    retained: true
    qos: 1
    stateTopic: shellies/y25_eg_garag_zip_0wzseite/announce
    transformationPattern: JSONPATH:$.ip

This is the Mqtt message sent by the device:

{
“id”: “y25_eg_garag_zip_0wzseite”,
“model”: “SHSW-25”,
“mac”: “40F52001930B”,
“ip”: “192.168.26.9”,
“new_fw”: false,
“fw_ver”: “20230503-095750/v1.13.0-g9aed950”,
“mode”: “roller”
}

The channel I setup as String and I see the full message… but I want to see the IP only…
=> I tried:
transformationPattern: JSONPATH:$.ip
transformationPattern: “JSONPATH:$.ip”
transformationPattern: ’ “JSONPATH:$.ip” ’
=> JSONPATH pattern is correct, but OH3 seems not to filter the rest… I tried to see if I need to install the binding but the binding section is so unorganized compared to OH2.4 that I did not find any JSON binding.

The channel displays always…

  • { “id”: “y25_eg_garag_zip_0wzseite”, “model”: “SHSW-25”, “mac”: “40F52001930B”, “ip”: “192.168.26.9”, “new_fw”: false, “fw_ver”: “20230503-095750/v1.13.0-g9aed950”, “mode”: “roller” }
    => As I see the string, the setup of the channel must be correct… no?

In OH2.4 I was doing this on daily basis and it was easy to do but here in OH3 I am completely stuck. Can please somebody tell me how I need to change the code? I red all documentation searched the forum but they seem all to show how this is solved on 2.4, which is easy.

Many thanks

Did you install JSONPATH transformation?
IMHO the INCOMING Transformation should be:

JSONPATH:$.ip
1 Like

ah… so I need to install JSONPATH transformation…
=> can you please guide me where to install it? I searched in bridge but I did not find it :frowning:

FOUND IT… I needed to go to…

  • EINSTELLUNGEN
  • BINDING
    => on the bottom of the screen (which was covered by my silly windows bar) there is a SEARCH … look for JSON and there you see transformation

Now it is working! To summarize for someone having the same issue…

  1. go to setup/bindings/others (it is of the bottom of the webbrowser) and search for JSONpath transformation and install it
  2. after you have created a new channel and you added JSONPATH:$.ip (best is to check the statement in an online evaluator) you need to go to CODE and check if you need to remove the "
  3. enjoy a channel which shows whatever you want

You can go directly to “Other Add-ons” from Settings.

image

1 Like