MQTT Engine module JSON payload parse error

Ignition Maker Edition Version: 8.1.2 (b2021020311)
MQTT Engine Module 4.0.6 (b2020111920)
Mosquitto 2.0.7

I am having an issue reporting certain topics via MQTT Engine into Ignition. I am running a mosquitto broker and have 4 relays connected to it and reporting status, as well as commanding the relay ON/OFF (I am using SONOFF relays with Tasmota firmware - https://tasmota.github.io/docs/MQTT/)

I have configured the MQTT Engine module to connect to my broker, and I have a custom namespace that points to the “home/lab/#” topic – configured to parse as JSON. Here is the module configuration:


2
3

I can see most of the topics in the tag browser:
4

However, when I turn the relay ON or OFF (by publishing a value of “0”, “OFF”, “1”, or “ON” to the topic /home/lab/relays/relay1/cmnd/POWER”, the following error message appears in the log:

The relay triggers just fine, but the error message appears in the log, and the …/cmnd/POWER topic does not show on the tag browser.

Here’s a screenshot of a client directly against the broker:

Thanks,
Oscar.

What’s the exact JSON string you’re publishing to /home/lab/relays/relay1/cmnd/POWER? I suspect it doesn’t meet the JSON spec perfectly in some way that your SONSOFF relays don’t care about but Ignition does.

The Sonoff will take any combination of 0/ON, 1/OFF, 2/TOGGLE. When I use 0/1/2, ignition will report correctly on the …/cmnd/POWER topic, but not when using the ON/OFF/TOGGLE strings - because they are not JSON-formatted it looks like.
when reporting status changes on topic “home/lab/relays/stat/relay2/RESULT”, the payload is {“POWER”:“OFF”}, and ignition can report the topic change correctly.

For now, I have set the namespace to not parse the payload as JSON, that seems to allow all topics to show in the tag browser, although I don’t have the granularity of all nodes downstream.

I can see if the Tasmota firmware can be set to always reply with JSON-formatted payloads.

It might be something simple like single-vs-double quotes. You’re only supposed to use double-quotes (") in JSON, but many implementations will accept single-quotes (’). In other words the difference between these two lines:

{“POWER”:“OFF”}
{“POWER”:'OFF'}

Subtle, but only the first is proper JSON.