(SOLVED)MQTT OH2 Problems with the 1.9 binding

Hello guys,
I have several problems with the 1.9 bindings to work properly.

Now the problem is with MQTT binding 1.9 on OH2

openhab> bundle:list

I can see everithing Active, something Resolved and
187 | Resolved | 80 | 1.9.0 | openHAB MQTT Binding 188 | Starting | 80 | 1.9.0 | openHAB MQTT Transport Bundle

Transport Bundle seems stoppend in starting phases. Why ?

Indeed I can see trought Karaf console that MQTT are recived by OpenHAB correcly, but i’m not able to recognise it on MQTTFX subscribing myself at # channel

Can someone help me ?

Is there a way to force it to restart?

Have i miss something guys??

I install MQTT binding starting from PAPER UI and edited the related .cfg file

I have to do something else?

I find out these post but i don’t know if I have to follow it, because I dont want to use OH 1.X binding legacy, I will create a new stable based only on OH2 after the official stable release.

MQTT and OH2 - not working

Please let me know,

Post you are referring to is very old (1 year ago, when there was not the possibility to install bindings from th paperUI.

I understand from your post that you can see the messages in the console. That indicates that the transport bundle already is working. I think the OH2 transport bundle is used. e.g. the one that is installed when executing feature:install openhab-transport-mqtt )

OH2 mqtt binding does not exist yet, main obstacle is that OH2 requires channels of certain data types. The first attempts of an OH2 version of mqtt binding created channels for each type which works, but is not a very nice approach.A improved on is in the works, but certainly not yet done.

Ok, thank you marcel,
indeed I search a lot and I read also very old posts hopping can help me, bet till now nothing.

Have you something to suggest based on your experience that I can try to make it my system work properly or add clues for a trubleshooting test ?

Thank you so much.

I solved the first problem by unistall and reinstall the Binding from the Paper UI.
Now the situation is:

ID | State    | Lvl | Version               | Name
 ---------------------------------------------------------------------------- ---  
  bla bla bla 
    189 | Active   |  80 | 1.9.0                 | openHAB Weather Binding
    191 | Active   |  80 | 1.9.0                 | openHAB MQTT Binding
    192 | Active   |  80 | 1.9.0                 | openHAB MQTT Transport Bundle

From the karaf consol I read

11:44:31.408 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw2' rec                                                                                                                                                             eived command ON
11:44:31.432 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw2 changed fr                                                                                                                                                             om OFF to ON
11:44:32.017 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw2' rec                                                                                                                                                             eived command OFF
11:44:32.028 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw2 changed fr                                                                                                                                                             om ON to OFF
11:44:36.450 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw2' rec                                                                                                                                                             eived command ON
11:44:36.459 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw2 changed fr                                                                                                                                                             om OFF to ON
11:44:37.010 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw2' rec                                                                                                                                                             eived command OFF
11:44:37.021 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw2 changed fr                                                                                                                                                             om ON to OFF
11:44:38.060 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw1' rec                                                                                                                                                             eived command ON
11:44:38.072 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw1 changed fr                                                                                                                                                             om OFF to ON
11:44:38.677 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'mqttsw1' rec                                                                                                                                                             eived command OFF
11:44:38.688 [INFO ] [marthome.event.ItemStateChangedEvent] - mqttsw1 changed fr                                                                                                                                                             om ON to OFF

But tracing the information with MQTTFX i cannot see anything about these commands,
seems they are passed from the UI to Openhab server but not delivered to the broker…

mmmmh I’m very confused :disappointed_relieved:

here also my mqtt.cfg

# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.

other info left hidden #

and the log file

2017-01-27 11:33:34.324 [INFO ] [.dashboard.internal.DashboardService] - Stopped dashboard
2017-01-27 11:35:28.768 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ZedHome.items'
2017-01-27 11:35:36.778 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ZedHome.rules'
2017-01-27 11:35:38.967 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'ZedHome.rules' is either empty or cannot be parsed correctly!
2017-01-27 11:35:39.043 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ZedHome.script'
2017-01-27 11:35:40.038 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ZedHome.sitemap'
2017-01-27 11:35:41.323 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'ZedHome.things'
2017-01-27 11:35:41.384 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'ZedHome.things' is either empty or cannot be parsed correctly!
2017-01-27 11:35:49.051 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-01-27 11:35:52.459 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-01-27 11:35:53.240 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-01-27 11:35:53.810 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-01-27 11:35:56.115 [DEBUG] [org.openhab.binding.weather         ] - BundleEvent STARTING - org.openhab.binding.weather
2017-01-27 11:35:56.149 [DEBUG] [eather.internal.bus.WeatherActivator] - Weather binding has been started.
2017-01-27 11:35:56.383 [DEBUG] [org.openhab.binding.weather         ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.weather.WeatherBindingProvider}={component.name=org.openhab.binding.weather.genericbindingprovider, component.id=159, service.id=286, service.bundleid=189, service.scope=bundle} - org.openhab.binding.weather
2017-01-27 11:35:56.794 [DEBUG] [.weather.internal.gfx.WeatherServlet] - Starting up weather servlet at /weather
2017-01-27 11:35:57.399 [DEBUG] [org.openhab.binding.weather         ] - ServiceEvent REGISTERED - {javax.servlet.ServletContext}={osgi.web.symbolicname=org.openhab.binding.weather, osgi.web.version=1.9.0, osgi.web.contextpath=/, service.id=287, service.bundleid=189, service.scope=singleton} - org.openhab.binding.weather
2017-01-27 11:35:57.436 [DEBUG] [org.openhab.binding.weather         ] - BundleEvent STARTED - org.openhab.binding.weather
2017-01-27 11:35:57.466 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTING - org.openhab.binding.mqtt
2017-01-27 11:35:57.514 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2017-01-27 11:35:57.685 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTED - org.openhab.binding.mqtt
2017-01-27 11:36:00.116 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@1297543' takes more than 5000ms.
2017-01-27 11:36:01.751 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-moon at midnight for thing astro:moon:local
2017-01-27 11:36:01.755 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-01-27 11:36:01.816 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:moon:local
2017-01-27 11:36:02.930 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:moon:local
2017-01-27 11:36:03.100 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:local
2017-01-27 11:36:06.071 [WARN ] [thome.binding.ntp.handler.NtpHandler] - ntp:ntp:local couldn't establish network connection [host '0.pool.ntp.org'] -> returning current sytem time instead.

nothing happened i the logs during karaf record status change

The 1.9 version mqtt binding is in very wide use with OH2, If there would be structural issues with it, I think the forum would be flooding with topics around it.

Hence most logical thing is that there is a local issue, either with the config file, or with your item definition.
What you could try is to have the item definition working in OH1.x, so you can exclude an item definition issue.
Run with debug level on the mqtt binding will maybe also give more details. esp at time of starting the bundle.

e.g. execute bundle:restart [your mqtt transport bundle#]
and check if any errors occurs

for reference I installed biding from paperUI, my log shows:

openhab> bundle:list | grep MQ
203 | Active   |  80 | 1.9.0.b5              | openHAB MQTT Binding
207 | Active   |  80 | 1.9.0.b5              | openHAB MQTT Transport Bundle

I solved by brute force:

backup /etc/openhab2

sudo apt-get purge openhab2

sudo apt-get intall openhab2


I dont do anything alse.