[SOLVED] Item from mqtt topic with colons and JSONPATH

Hi there, looking forward to your help with my MQTT + Item + JSONPATH problem. mqtt is working but I can’t get this one right.

Incoming MQTT message
topic : this/is/th:et:op:ic
payload: {"test":"100"}

String VeryMuchHelpNeeded {mqtt="<[mosquitto:this/is/th:et:op:ic:state:JSONPATH($.test)]"}

isn’t working. Any idea how to solve this? I cannot alter the topic (because those are MAC addresses) btw

I keep thinking it’s the colons in that topic.

Yes, I think you are correct about the colons. I think its usually on 4 parts ( 3 colons ) to a message being received by OH.

What error does your log show?

Try to escape the colons with \ :

String VeryMuchHelpNeeded {mqtt="<[mosquitto:this/is/th\:et\:op\:ic:state:JSONPATH($.test)]"}

Escaping didnt work:

 [el.core.internal.ModelRepositoryImpl] - Configuration model 'mqtt.items' has errors, therefore ignoring it: [32,34]: mismatched character ':' expecting set null
[32,72]: mismatched input '9C' expecting RULE_STRING
[33,117]: mismatched character '&lt;EOF&gt;' expecting '"'
[ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'mqtt' of item 'VeryMuchHelpNeeded' could not be parsed correctly.

org.eclipse.smarthome.model.item.BindingConfigParseException: Configuration 'mosquitto:this/is/th:et:op:ic:state:JSONPATH($.test)]' is not a valid inbound configuration: Configuration requires 4 or 5 parameters separated by ':'

So - any workaround around the colons?

Try using \\: instead.

1 Like

@namraccr - I LOVE YOU :heart_eyes: thank you very much!

You’re welcome. :smile:

This should be added to the binding documentation

Done. :slight_smile:

1 Like