I have been struggling with the MQTT 2.x binding quite alot and have created various test cases, but I struggle here. Hopefully one of the friendly forum members can help me?
What seems to work (all configured via HABadmin / paperui)
mosquito is working
binding is installed in openhab, binding connects to MQTT service
event is triggered (“vent.ChannelTriggeredEvent”) when I update the mqtt channel.
I saw that there are a lot of discussions about MQTT in the forum, but I was not able to find any an mqtt binding 2.x howto. If I have overseen it, then please accept my sincere apologies - but I have spent quite a lot of time trying back and forth :-).
There is no “official” documentation out yet for MQTTv2
In principle, when using any 2.x Binding, your Item config needs to point to a Channel
Your Item config is still pointing to a legacy (1.x) style of config
Get the Channel Unique Identifier (CUID) from PaperUI and dump it in your Item ... { channel="CUID" }
Q: I am still struggling, but hopefully you can “push” me into the right direction? I have read the smarthome binding readme - do you suggest that I perform the configuration manually instead of using paper-ui?
Status: I have also tried to move away from the “legacy(1.x)” configuration from the mqtt.items file - but this was no success. As you can see I have added the CUID into the “channel” - but openhab now no longer “sees” the mqtt updates (on/off) while I see them beeing send to mosquitto.
sorry… i haven’t even started to study the new MQTTv2 binding to be able to help with troubleshooting…
I will have to do this at a certain moment to migrate all my MQTTv1 stuff over but I keep postponing this
You added a channel to the MQTT broker connection
You need to create another Thing with a switch channel (Follow the instruction link 2 posts above)
and then link your item to that channel
Verified that MQTT is received from a local client
mosquitto_sub -v -t 'SWTest' -d
(Please note that MQTT topics are case sensitive)
— if you don’t see the data from (2) here STOP. do not continue
Installed the MQTT 2.x Binding via Paper-UI
a) Things > MQTT > MQTT Broker
b) Things > MQTT > ADD MANUALLY > Generic MQTT Thing
Add Switch
c) Link a new Switch into the MQTT Switch
Verify that (2) is able to update switch, relevant logs may be /var/log/openhab2/events.log
2018-12-07 14:45:31.732 [ome.event.ItemCommandEvent] - Item 'Switch_MQTT_SWTest' received command OFF
2018-12-07 14:45:31.734 [nt.ItemStatePredictedEvent] - Switch_MQTT_SWTest predicted to become OFF
2018-12-07 14:45:31.735 [vent.ItemStateChangedEvent] - Switch_MQTT_SWTest changed from ON to OFF
2018-12-07 14:45:35.505 [ome.event.ItemCommandEvent] - Item 'Switch_MQTT_SWTest' received command ON
2018-12-07 14:45:35.506 [nt.ItemStatePredictedEvent] - Switch_MQTT_SWTest predicted to become ON
2018-12-07 14:45:35.507 [vent.ItemStateChangedEvent] - Switch_MQTT_SWTest changed from OFF to ON
2018-12-07 14:45:39.277 [ome.event.ItemCommandEvent] - Item 'Switch_MQTT_SWTest' received command OFF
2018-12-07 14:45:39.278 [nt.ItemStatePredictedEvent] - Switch_MQTT_SWTest predicted to become OFF
2018-12-07 14:45:39.279 [vent.ItemStateChangedEvent] - Switch_MQTT_SWTest changed from ON to OFF
Thanks for the feedback and thanks for being so response. I have been testing, failing, testing, failing over multiple weeks and was about to give up the 2.x binding. But luckily we have some very helpful people in this forum here that pointed the beginner into the right direction.
I’ll post a tibber/mqtt integration howto later (once confirmed working).