[Solved] Need HELP! OpenHab It does not receive or send data MQTT

Thanks for the answer!
But then the error on the side of openhab.
Today I wrote a arduino sketch for temperature sensors ds18b20
Opened the mosquito. cmd… bla… bla… bla… mosquitto -v
Opened MQTT spy
These are !!! Working!!!

Mosquitto shows that openhab connected. There is a ping!

A openhab no data! :frowning:

I do not understand what’s the problem !?
I’m an idiot? :smile:

Did you look at these examples? If you used Daniel’s example exactly, please consider changing it to

Switch Light_My_room_Ceiling 	"Верхний свет" 		(house_My_room, Lights,  Status) { mqtt=">[mosquitto:/myhome/Light_My_room_Ceiling/command:command:ON:on],>[mosquitto:/myhome/Light_My_room_Ceiling/command:command:OFF:off],<[mosquitto:/myhome/Light_My_room_Ceiling/state:state:default]"     }

and noting that ON is the command to match, and on is what is published in that case. Also note that you would have to publish ON or OFF from the other side so the switch can be updated properly, since you have default in the inbound item binding. Or change default to a transform.

I tried all the options!
Does not work!

Neither team of openhab mqtt does not go to mosquitto!
And do not come to openhab

For the second day I can not do anything ((((

I see you have partially set up the MQTT Event Bus binding, but unless you meant to do that, change

mqtt:mosquitto.url=tcp://<myip>:1883
eventbus:broker=mosquitto
mqtt-eventbus:commandPublishTopic=/myhome/in/${item}/command
mqtt-eventbus:statePublishTopic=/myhome/state/${item}/state
mqtt-eventbus:stateSubscribeTopic=/myhome/out/${item}/state

to

mqtt:mosquitto.url=tcp://<myip>:1883

(In other words, no need to specify anything beyond the broker URL.) So you are running the mosquitto broker on the machine at <myip> on port 1883, with no passwords or encryption on that port?

I tried only MQTT: mosquitto.url = TCP: //localhost:1883

Windows Firewall turned off.
Antivirus disabled.
Additionally, create a rule for port 8080 and 1883 (opened)
Checked CMD netstat -ano
Everything is fine!
1883 mosquito
8080 Java (openhab)

Black magic! :smile

I tried to put on her laptop openhab!
Win 7 x64

Write in the config MQTT: mosquitto.url = TCP: //192.168.0.103:1883
(192.168.0.103 ip pc mosqitto)

Start Openhab!
and I get an error
[ERROR] [.io.transport.mqtt.MqttService] - Error starting broker connection

Hm!!! New Bug!!!

read MQTT binding - Error starting broker connection

I tried to install the mosquito on the same laptop (Win 7 x64)
Test mosquitto. Work good.

Analog error
[ERROR] [.io.transport.mqtt.MqttService] - Error starting broker connection

It’s getting ridiculous. I set up a lot of time such systems as AMX, Creston, Lutron and more!
Familiar with many protocols.
And I can not adjust the MQTT ))))

Hi, Aleksandr!

I have the same problem! %-)

Mosquitto and MQTT Spy work fine! OpenHab connect to Mosquitto without errors - It is seen in the log files. It works on miniPC with Win10 32 bit

But I can not receive or transmit commands between OpenHab and Mosquitto!

Black magic! %-)))

Hello, friends!
The problem was solved by reinstalling version Openhab 1.8 to 1.7.1
Everything works perfectly!

It appears in version 1.8 has an unknown error !!!

Version Mosquitto 1.4.7

Thank you all for your help!

Alexander, thanks!
Downgrade to version 1.7.1 and MQTT works without problems!

What exactly did you downgrade?

Openhab 1.8 то 1.7.1

Thank you, Aleksandr. Is there any chance you could take the org.openhab.binding.mqtt-1.8.0.jar and use it on your openHAB 1.7.1 installation in place of org.openhab.binding.mqtt-1.7.1.jar to see if that breaks your configuration again? It would help in trying to isolate the nature of your issue, in hopes of allowing you to upgrade back to current.

I am not Alexander…
But I did an experiment

  1. Updated runtime from 1.7.1. to 1.8.0
    MQTT - works!

  2. And updated Add-on from org.openhab.binding.mqtt-1.7.1.jar to org.openhab.binding.mqtt-1.8.0.jar
    MQTT - works!

What was the problem do not understand…

1 Like

hi,
alexander

even i faced the same problems you faced to make the openhab send the mqtt messages so try to do the following

  1. check if you have copied the correct addons to the add-ons directory in the openhab runtime. in openhab ver 1.8 there are two mqtt addons one is named as org.openhab.actions.mqtt and one more named as org.openhab.binding.mqtt . note that you have to copy the bindings to the add ons folder in your runtime

  2. make sure you have your mqtt broker running and when you run openhab make sure that you see something getting connected in your broker window.

  3. in the openhab config file change the line under mqtt transport to
    mqtt:mybroker.url=tcp://localhost:1883
    in that make sure you define some name to the broker in openhab like i have defined as mybroker

try these things and atleast you will able to see the mqtt messages on your subscribe all window

You really saved my day! I was also suffering for hours as to why my messages were not sent from openHAB to my RPi through MQTT.
I installed the org.openhab.action.mqtt-1.8.3.jar file, but I was NOT aware there was also a second JAR file needed to get the feature working fine: org.openhab.binding.mqtt-1.8.3.jar.
I spent hours chasing an error which I thought was because of me in my scripts, but it was just a lacking JAR file.
A pity this is not mentioned in the openHAB documentation of the MQTT binding (here). Would have saved me hours of frustration…

PS: adding debug information in the logback.xml file (as is explained here) is/was also very useful!

You’re welcome! :slight_smile:

I have both .jar files but openhab is still not updating :frowning: someone help me

Have you followed the guidelines explained in the second link in my post above? When you add the debug lines in the logback.xml file, you should at least see if the MQTT binding is fine and if the subscription is done properly.
By the way, that whole message thread is worth reading. It learned me a lot on how to try to tackle down the problems I faced with MQTT.

How do downgrade my openhab?

This is my openhab debug! The status isn’t being updated in openHAB.

Last login: Tue Oct 11 20:16:56 on ttys000
LaSpencias-MacBook-Air:~ laspencia$ /opt/openhab/runtime/start_debug.sh ; exit;
Launching the openHAB runtime in debug mode…
Listening for transport dt_socket at address: 8001
osgi> 20:20:33.296 [DEBUG] [.s.internal.SchedulerActivator:36 ] - Scheduler has been started.
20:20:33.342 [INFO ] [uartz.impl.StdSchedulerFactory:1175 ] - Using default implementation for ThreadExecutor
20:20:33.365 [INFO ] [rtz.core.SchedulerSignalerImpl:61 ] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
20:20:33.366 [INFO ] [rg.quartz.core.QuartzScheduler:243 ] - Quartz Scheduler v.2.1.7 created.
20:20:33.368 [INFO ] [org.quartz.simpl.RAMJobStore :154 ] - RAMJobStore initialized.
20:20:33.370 [INFO ] [rg.quartz.core.QuartzScheduler:268 ] - Scheduler meta-data: Quartz Scheduler (v2.1.7) ‘openHAB-job-scheduler’ with instanceId ‘NON_CLUSTERED’
Scheduler class: ‘org.quartz.core.QuartzScheduler’ - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool ‘org.quartz.simpl.SimpleThreadPool’ - with 2 threads.
Using job-store ‘org.quartz.simpl.RAMJobStore’ - which does not support persistence. and is not clustered.

20:20:33.371 [INFO ] [uartz.impl.StdSchedulerFactory:1324 ] - Quartz scheduler ‘openHAB-job-scheduler’ initialized from specified file: ‘./etc/quartz.properties’
20:20:33.372 [INFO ] [uartz.impl.StdSchedulerFactory:1328 ] - Quartz scheduler version: 2.1.7
20:20:33.372 [INFO ] [rg.quartz.core.QuartzScheduler:534 ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.
20:20:33.376 [DEBUG] [o.config.core.ConfigDispatcher:146 ] - Processing openHAB default configuration file ‘/opt/openhab/runtime/configurations/openhab_default.cfg’.
20:20:33.438 [DEBUG] [o.config.core.ConfigDispatcher:168 ] - Processing openHAB main configuration file ‘/opt/openhab/runtime/configurations/openhab.cfg’.
20:20:33.464 [DEBUG] [.o.core.internal.CoreActivator:93 ] - UUID file already exists at ‘/opt/openhab/runtime/webapps/static/uuid’ with content ‘2045263c-1f04-489e-9dfe-53693766ffb8’
20:20:33.466 [DEBUG] [.o.core.internal.CoreActivator:115 ] - Created file ‘/opt/openhab/runtime/webapps/static/version’ with content ‘1.8.3’
20:20:33.466 [INFO ] [.o.core.internal.CoreActivator:61 ] - openHAB runtime has been started (v1.8.3).
20:20:33.507 [DEBUG] [a.internal.AutoUpdateActivator:31 ] - AutoUpdate binding has been started.
20:20:35.013 [DEBUG] [.p.i.PersistenceModelActivator:23 ] - Registered ‘persistence’ configuration parser
20:20:35.041 [DEBUG] [.c.t.i.TransformationActivator:38 ] - Transformation Service has been started.
20:20:35.096 [DEBUG] [m.internal.MultimediaActivator:34 ] - Multimedia I/O bundle has been started.
20:20:35.123 [DEBUG] [.s.i.DiscoveryServiceActivator:27 ] - Discovery service has been started.
20:20:35.128 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl:93 ] - mDNS service has been started
20:20:35.147 [DEBUG] [.io.transport.mqtt.MqttService:123 ] - Starting MQTT Service…
20:20:35.171 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl:53 ] - Service Discovery initialization completed.
20:20:35.298 [DEBUG] [.i.internal.ItemModelActivator:24 ] - Registered ‘item’ configuration parser
20:20:35.414 [DEBUG] [o.o.c.i.items.ItemRegistryImpl:137 ] - Item provider ‘GenericItemProvider’ has been added.
20:20:36.388 [DEBUG] [.o.m.s.i.SitemapModelActivator:23 ] - Registered ‘sitemap’ configuration parser
20:20:36.489 [DEBUG] [io.rest.internal.RESTActivator:33 ] - REST API has been started.
20:20:36.550 [INFO ] [org.atmosphere.util.IOUtils :370 ] - META-INF/services/org.atmosphere.cpr.AtmosphereFramework not found in class loader
20:20:36.573 [INFO ] [sphere.cpr.AtmosphereFramework:2601 ] - Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
20:20:36.575 [INFO ] [cpr.DefaultAnnotationProcessor:138 ] - AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$BytecodeBasedAnnotationProcessor being used
20:20:36.586 [WARN ] [cpr.DefaultAnnotationProcessor:178 ] - Unable to detect annotations. Application may fail to deploy.
20:20:36.612 [INFO ] [sphere.cpr.AtmosphereFramework:1891 ] - Auto detecting atmosphere handlers /WEB-INF/classes/
20:20:36.628 [INFO ] [sphere.cpr.AtmosphereFramework:639 ] - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path /* and Broadcaster Class org.atmosphere.jersey.JerseyBroadcaster
20:20:36.628 [INFO ] [sphere.cpr.AtmosphereFramework:1945 ] - Auto detecting WebSocketHandler in /WEB-INF/classes/
20:20:36.629 [INFO ] [sphere.cpr.AtmosphereFramework:1602 ] - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
20:20:36.657 [INFO ] [.a.h.ReflectorServletProcessor:103 ] - Installing Servlet com.sun.jersey.spi.container.servlet.ServletContainer
20:20:36.763 [INFO ] [c.s.j.s.i.a.WebApplicationImpl:815 ] - Initiating Jersey application, version ‘Jersey: 1.18.1 02/19/2014 03:28 AM’
20:20:36.766 [INFO ] [c.s.j.s.i.a.WebApplicationImpl:826 ] - Adding the following classes declared in META-INF/services/jersey-server-components to the resource configuration:
class org.atmosphere.jersey.AtmosphereResourceConfigurator
20:20:36.818 [INFO ] [j.s.i.a.DeferredResourceConfig:101 ] - Instantiated the Application class org.openhab.io.rest.RESTApplication
20:20:37.569 [INFO ] [sphere.cpr.AtmosphereFramework:2435 ] - AtmosphereInterceptor CORS Interceptor Support will always be executed first
20:20:37.572 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor CORS Interceptor Support with priority FIRST_BEFORE_DEFAULT
20:20:37.573 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Default Response’s Headers Interceptor with priority AFTER_DEFAULT
20:20:37.575 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Android Interceptor Support with priority AFTER_DEFAULT
20:20:37.576 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor SSE Interceptor Support with priority AFTER_DEFAULT
20:20:37.577 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor JSONP Interceptor Support with priority AFTER_DEFAULT
20:20:37.580 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Atmosphere JavaScript Protocol with priority AFTER_DEFAULT
20:20:37.581 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Browser disconnection detection with priority AFTER_DEFAULT
20:20:37.587 [INFO ] [sphere.cpr.AtmosphereFramework:935 ] - Using EndpointMapper class org.atmosphere.util.DefaultEndpointMapper
20:20:37.589 [WARN ] [sphere.cpr.AtmosphereFramework:941 ] - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
20:20:37.589 [INFO ] [sphere.cpr.AtmosphereFramework:949 ] - Default Broadcaster Class: org.atmosphere.jersey.JerseyBroadcaster
20:20:37.590 [INFO ] [sphere.cpr.AtmosphereFramework:950 ] - Broadcaster Polling Wait Time 100
20:20:37.590 [INFO ] [sphere.cpr.AtmosphereFramework:951 ] - Shared ExecutorService supported: true
20:20:37.593 [INFO ] [sphere.cpr.AtmosphereFramework:958 ] - Messaging Thread Pool Size: 10
20:20:37.594 [INFO ] [sphere.cpr.AtmosphereFramework:968 ] - Async I/O Thread Pool Size: 10
20:20:37.595 [INFO ] [sphere.cpr.AtmosphereFramework:979 ] - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
20:20:37.595 [INFO ] [sphere.cpr.AtmosphereFramework:980 ] - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
20:20:37.595 [INFO ] [sphere.cpr.AtmosphereFramework:990 ] - Invoke AtmosphereInterceptor on WebSocket message true
20:20:37.596 [INFO ] [sphere.cpr.AtmosphereFramework:991 ] - HttpSession supported: false
20:20:37.597 [INFO ] [sphere.cpr.AtmosphereFramework:993 ] - Atmosphere is using DefaultAtmosphereObjectFactory for dependency injection and object creation
20:20:37.597 [INFO ] [sphere.cpr.AtmosphereFramework:994 ] - Atmosphere is using async support: org.atmosphere.container.JettyAsyncSupportWithWebSocket running under container: jetty/8.1.3.v20120522 with WebSocket enabled.
20:20:37.599 [INFO ] [sphere.cpr.AtmosphereFramework:996 ] - Atmosphere Framework 2.2.5 started.
20:20:37.599 [INFO ] [sphere.cpr.AtmosphereFramework:998 ] -

For Atmosphere Framework Commercial Support, visit 
http://www.async-io.org/ or send an email to support@async-io.org

20:20:37.603 [INFO ] [penhab.io.rest.RESTApplication:144 ] - Started REST API at /rest
20:20:37.605 [DEBUG] [o.o.i.s.i.DiscoveryServiceImpl:66 ] - Registering new service _openhab-server._tcp.local. at port 8080
20:20:42.914 [DEBUG] [o.o.i.s.i.DiscoveryServiceImpl:66 ] - Registering new service _openhab-server-ssl._tcp.local. at port 8443
20:20:44.336 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘demo.sitemap’
20:20:44.563 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘demo.script’
20:20:44.660 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘db4o.persist’
20:20:44.678 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘exec.persist’
20:20:44.684 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘logging.persist’
20:20:44.689 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘rrd4j.persist’
20:20:44.720 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘demo.items’
20:20:44.735 [DEBUG] [i.internal.GenericItemProvider:154 ] - Processing binding configs for items from model ‘demo.items’
20:20:44.737 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model ‘demo.items’
20:20:45.577 [INFO ] [.o.u.w.i.servlet.WebAppServlet:80 ] - Started Classic UI at /classicui/openhab.app
20:20:46.003 [DEBUG] [.r.internal.RuleModelActivator:42 ] - Registered ‘rules’ configuration parser
20:20:46.019 [DEBUG] [m.r.internal.engine.RuleEngine:77 ] - Started rule engine
20:20:50.096 [DEBUG] [.a.mqtt.internal.MqttActivator:34 ] - Mqtt action has been started.
20:20:50.101 [DEBUG] [.o.b.ntp.internal.NtpActivator:31 ] - NTP binding has been started.
20:20:50.114 [INFO ] [.service.AbstractActiveService:169 ] - NTP Refresh Service has been started
20:20:50.115 [DEBUG] [inding.ntp.internal.NtpBinding:78 ] - There is no existing NTP binding configuration => refresh cycle aborted!
20:20:50.117 [DEBUG] [xecPersistenceServiceActivator:33 ] - Exec persistence bundle has been started.
20:20:50.126 [DEBUG] [.p.internal.PersistenceManager:146 ] - Initializing exec persistence service.
20:20:50.151 [DEBUG] [.p.internal.PersistenceManager:428 ] - Scheduled strategy exec.everyMinute with cron expression 0 * * * * ?
20:20:50.167 [DEBUG] [.rrd4j.internal.RRD4jActivator:31 ] - RRD4j persistence bundle has been started.
20:20:50.180 [DEBUG] [.p.rrd4j.internal.RRD4jService:395 ] - Unknown property name : org.openhab.persistence.rrd4j
20:20:50.180 [DEBUG] [.p.rrd4j.internal.RRD4jService:364 ] - config ‘objectClass’ should have the format ‘name.configkey’
20:20:50.181 [DEBUG] [.p.rrd4j.internal.RRD4jService:405 ] - Created default_numeric = GAUGE heartbeat = 60 min/max = NaN/NaN step = 60 6 archives(s) = [ AVERAGE xff = 0.5 steps = 1 rows = 480 AVERAGE xff = 0.5 steps = 4 rows = 360 AVERAGE xff = 0.5 steps = 14 rows = 644 AVERAGE xff = 0.5 steps = 60 rows = 720 AVERAGE xff = 0.5 steps = 720 rows = 730 AVERAGE xff = 0.5 steps = 10080 rows = 520] 0 items(s) = []
20:20:50.182 [DEBUG] [.p.rrd4j.internal.RRD4jService:405 ] - Created default_other = GAUGE heartbeat = 3600 min/max = NaN/NaN step = 1 6 archives(s) = [ MAX xff = 0.999 steps = 1 rows = 3600 MAX xff = 0.999 steps = 10 rows = 1440 MAX xff = 0.999 steps = 60 rows = 1440 MAX xff = 0.999 steps = 900 rows = 2880 MAX xff = 0.999 steps = 21600 rows = 1460 MAX xff = 0.999 steps = 86400 rows = 3650] 0 items(s) = []
20:20:50.182 [INFO ] [.p.rrd4j.internal.RRD4jService:407 ] - Removing invalid defintion component = null heartbeat = 0 min/max = 0.0/0.0 step = 0 0 archives(s) = [] 0 items(s) = []
20:20:50.185 [DEBUG] [.p.internal.PersistenceManager:146 ] - Initializing rrd4j persistence service.
20:20:50.211 [DEBUG] [.p.internal.PersistenceManager:315 ] - Item ‘DemoSwitch’ does not exist.
20:20:50.212 [DEBUG] [.p.internal.PersistenceManager:315 ] - Item ‘NoOfLights’ does not exist.
20:20:50.213 [DEBUG] [.p.internal.PersistenceManager:315 ] - Item ‘Window_GF_Toilet’ does not exist.
20:20:50.213 [DEBUG] [.p.internal.PersistenceManager:328 ] - Item group ‘Heating’ does not exist.
20:20:50.214 [DEBUG] [.p.internal.PersistenceManager:328 ] - Item group ‘Temperature’ does not exist.
20:20:50.215 [DEBUG] [.p.internal.PersistenceManager:328 ] - Item group ‘Weather_Chart’ does not exist.
20:20:50.217 [DEBUG] [.p.internal.PersistenceManager:428 ] - Scheduled strategy rrd4j.everyMinute with cron expression 0 * * * * ?
20:20:50.222 [DEBUG] [p.r.i.charts.RRD4jChartServlet:118 ] - Starting up rrd chart servlet at /rrdchart.png
20:20:50.224 [DEBUG] [.i.LoggingPersistenceActivator:31 ] - Logging persistence bundle has been started.
20:20:50.231 [DEBUG] [.p.internal.PersistenceManager:146 ] - Initializing logging persistence service.
20:20:50.234 [DEBUG] [.b.http.internal.HttpActivator:34 ] - HTTP binding has been started.
20:20:50.246 [INFO ] [.service.AbstractActiveService:169 ] - HTTP Refresh Service has been started
20:20:50.248 [DEBUG] [.b.mqtt.internal.MqttActivator:34 ] - MQTT binding has been started.
20:20:50.262 [DEBUG] [i.internal.GenericItemProvider:341 ] - Start processing binding configuration of Item ‘itm_garage_dist (Type=NumberItem, State=Uninitialized)’ with ‘MqttGenericBindingProvider’ reader.
20:20:50.264 [DEBUG] [b.mqtt.internal.MqttItemConfig:72 ] - Loaded MQTT config for item ‘itm_garage_dist’ : 1 subscribers, 0 publishers
20:20:50.271 [DEBUG] [m.internal.MqttEventBusBinding:68 ] - MQTT: Activating event bus binding.
20:20:54.869 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘demo.rules’