[SOLVED] MQTT2 Equivalent

I am trying to recreate the setup where three different state messages can be received to set the value of the same Item. The way I have set it up does not update the Item value. No information messages associated with this Item appear in the log.

In mqtt1 I defined three incoming MQTT messages.

In mqtt2 I created a Generic MQTT Thing with four channels.

  • The first channel receives the switch state and issue the switch command. The Item linked to this Channel works as expected.
  • The remaining Channels (3) each have a unique Channel ID and state topic. The state topic for each Channel corresponds to the same topic I had in the mqtt1 Item declaration. I have included a screenshot of the declaration of one of these Channels showing the topic and the JSONPath transformation. Again, the JSONPath corresponds to the same transformation I used in the mqtt1 Item declaration. I copy and pasted the string srom my mqtt1 Items file over to PaperUI. I have the same Item linked to each of those three Channels. with mqtt2 is it allowed to link the same Item to multiple Channels?

mqtt1 Items

Switch      cwiHouse_FF_laundry_washer
            "Washer"
            ["Switchable"]
            { mqtt=">[openhab_tcpbroker:cmnd/sonoff-washer_monitor/POWER:command:*:default],
                    <[openhab_tcpbroker:stat/sonoff-washer_monitor/POWER:state:default]" }

Number      cwiHouse_FF_laundry_washer_monitor_power
            "Washer Monitor: Current Power Load [%d] W" <none>             { mqtt="
                    <[openhab_tcpbroker:tele/sonoff-washer_monitor/SENSOR:state:JSONPATH($.ENERGY.Power)],
                    <[openhab_tcpbroker:stat/sonoff-washer_monitor/STATUS8:state:JSONPATH($.StatusSNS.ENERGY.Power)],
                    <[openhab_tcpbroker:stat/sonoff-washer_monitor/STATUS10:state:JSONPATH($.StatusSNS.ENERGY.Power)]
                   " }

I have set up the broker (mosquitto) and created the Broker Thing. It is connected and ONLINE.

mqtt2 Things


mqtt2 Items

Switch      cwiHouse_FF_laundry_washer
            "Washer"
            ["Switchable"]

Number      cwiHouse_FF_laundry_washer_monitor_power
            "Washer Monitor: Current Power Load [%d] W" <none> 

Yes.
You can also do the converse - have multiple Items linked to the same channel. I would suggest maybe making a couple of temporary Items to link to link to each your channels individually, for testing.

What doesn’t happen?

I added another channel to receive the full MQTT JSON payload and linked a String Item to it to confirm that openHAB was receiving the messages. I did nothing else… and the original Item began updating. I deleted the “test” channel and the original Item continued being updated.

Mind you, I had restarted openHAB. I had rebooted. It had temporary insanity and was cleared by me adding another channel.

Mike

P.S. I then exported the Things via the REST Documentation and cloned another similar Thing for my dryer monitor by grabbing the washer Thing, replacing the necessary strings, and importing via REST. Voila! Easy Peasy Thing creating with all my channels w/o lots of PaperUI clicking. Thanks @rlkoshak!