MQTT - How to parse this data

Hello everyone,

I have a MQTT channel that I’m unsure how to add a channel to get this value (or an item from that channel).

The channel publish value
{“critical”: true}

I guess it could have other value. It seems to be json. How can I have an item (and channel) to read that value?

Like an item that would be critical on/off based on the true/false of the critical here.

Thank you!

Given that the only values are true and false the easy way is to use incomming transformation:

UID: mqtt:topic:test
label: Generic MQTT Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:mosquitto
channels:
  - id: critical
    channelTypeUID: mqtt:switch
    label: Critical
    description: ""
    configuration:
      stateTopic: my/topic
      transformationPattern: JSONPATH:$.critical
      off: "false"
      on: "true"

You have to install jsonPath transformation service to get this channel working.

AH! JSONTPATH transformation, I forgot about that one. Just tried $.critical in the item using the gui and it worked.

Thank you!

1 Like