[SOLVED] Received update triggered multiple times with multiple MQTT transformations

Using OpenHAB 2.5M5

Thing mqtt:topic:mosquitto:doorbell_button "Doorbell Switch" (mqtt:broker:mosquitto) {
    Channels:
       Type string : click  "Click" [ stateTopic="zigbee/doorbell-button", transformationPattern="JSONPATH:$.click"  ]
}
String Doorbell_Button_Click "Doorbell Switch Click" (gDoorbell) { channel="mqtt:topic:mosquitto:doorbell_button:click" }
rule "Zigbee Button"
when
    Item Doorbell_Button_Click received update
then
    logInfo("Doorbell", Doorbell_Button_Click.state.toString)
end

When the config is as above, everything is fine. Press the button once, ONE log entry would appear.

However, when I added another channel:

Thing mqtt:topic:mosquitto:doorbell_button "Doorbell Switch" (mqtt:broker:mosquitto) {
    Channels:
       Type string : click  "Click" [ stateTopic="zigbee/doorbell-button", transformationPattern="JSONPATH:$.click"  ]
        Type string : action  "Action" [ stateTopic="zigbee/doorbell-button", transformationPattern="JSONPATH:$.action"  ]
}

Without changing the Items / rules, multiple log items would now appear for every physical button click, thus implying that the “received update” got fired multiple times.

I suspect the cause is that there are multiple channels using the same stateTopic.

My expected behaviour would be that it only gets fired once, since only one MQTT message was received for every physical click.

You can test this by simply publishing a JSON message to mqtt as such {"click":"single"}

There are two channels each subscribing to the same topic. Each channel gets triggered. Therefore 2 log entries. Why is that a problem?

Also with zigbee2mqtt payloads, the JSON structure is not always the same, so if there is no $.action in the JSON the second channel will pop an error.

But I see the point - the Item is linked to only one of those channels, The rule is monitoring Item update, and so we would expect only one.

Really sure about that?

The log entry is triggered by this:

logInfo("Doorbell", Doorbell_Button_Click.state.toString)

so there should just be one entry, one event, the item being updated once only, not multiple times.

Yes, really sure.

The more number of channels I have subscribing to the same stateTopic, the crazier it gets, i.e. the more number of times the rule gets fired for just one mqtt message.

Yes, the same thing happens with Tasmota’s stat/xxx/RESULT:

23:23:03.592 [WARN ] [tt.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.Dimmer' in '{"POWER":"OFF"

Do you know of a way to suppress the warnings?

Use js transforms to check if the json key exists or as I do use node-red to “translate” the topic and payload

What are your rule triggers?

Use chaining transformations and check that the JSON element exists using REGEX first. MQTT 2.5 M1+ How to implement the equivalent to MQTT1 REGEX filters.

Does this only happen if you specify a transform? i.e. try a raw string as well perhaps. I’m thinking binding bug in the chaining feature.