MQTT binding, broker configured but not used


(Bryan Lee Ragon) #1

Openhabian installation. Trying to get OpenHab 2.4 working with mosquitto and some Tasmota Sonoff devices.

Mosquitto and the Sonoffs are working just fine. I can subscribe to their topics, see state changes and publish topics that switch the lights.

I have installed the MQTT binding through Paper UI.

I have edited my mqtt.cfg file:

    pid:org.openhab.mqtt
    mqtt.qos=1
    mqtt.retain=true
    mqtt.async=false
    mqtt.url=tcp://127.0.0.1:1883
    mqtt.clientId=oh2
    mqtt.user=openhabian
    mqtt.pwd=ObligatoryPwd

And my mqtt.cfg items file:

Switch sonoff_attic_light "Attic  Lights" { mqtt="<[mqtt:stat/sonoff-light-attic/POWER:state:default], >[mqtt:cmnd/sonoff-light-attic/POWER:command:ON:on], >[mqtt:cmnd/sonoff-light-attic/POWER:command:OFF:off]" }

In the console:

>config:edit org.openhab.mqtt
>config:property-list
   mqtt.async = false
   mqtt.clientId = oh2
   mqtt.pwd = ObligatoryPwd
   mqtt.qos = 1
   mqtt.retain = true
   mqtt.url = tcp://127.0.0.1:1883
   mqtt.user = openhabian

Log:

2018-12-27 07:52:45.570 [WARN ] [g.dispatch.internal.ConfigDispatcher] - The file /etc/openhab2/services/mqtt.cfg subsequently defines the exclusive PID 'org.openhab.mqtt'. Overriding existing configuration now.

2018-12-27 07:53:08.858 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'mqtt.items'
2018-12-27 07:53:08.887 [ome.event.ItemUpdatedEvent] - Item 'sonoff_attic_light' has been updated.

So it appears that it is not even trying to connect to the broker. Any ideas?


(Vincent Regaud) #2

Which MQTT binding did you install? v1 or v2?


(Vincent Regaud) #3

If you are using v2, see:

If you are using v1 see:


(Bryan Lee Ragon) #4

Paper UI -> Add Ons -> Bindings -> MQTT (binding-mqtt - 2.4.0)

I will double check the MQTT2 binding Tutorial you listed, thank you!


(Bryan Lee Ragon) #5

Yeah, I was definitely confused. Still doing my initial setup and didn’t realize the MQTT binding underwent a major upgrade during that time. Still fighting to get it working, but I’ll leave this thread as is and start a new one if I need to.