Issues with MQTT&Arduino Temp/humidity sensor

Hello OpenHAB community, I am new to Openhab & Arduino and loving the project. However I am having a wired issues here where i cant see any MQTT updates in Openhab and looking for some community support.

Things i have done:

  1. reinstalled OpenHAB/mosquitto MQTT 3.1 running on rpi
  2. Granting openhap user access to /etc/openhab/ and /usr/share/openhab
  3. checked to make sure addons are in correct folder.
  4. repeatedly checked code

The setup:

I have a Arduino Temp/humidity sensor publishing MQTT updated. I can see publish values on my mac via MQTT.fx and my broker:
pi@raspberrypi /etc/openhab/configurations/items $ mosquitto_sub -h 192.168.1.200 -t "#" -v home/master/temperature Active home/master/humidity Active home/master/temperature 24.00 home/master/humidity 38.00 home/master/temperature 24.00 home/master/humidity 38.00

Also openhab.log file reports MQTT is starting
2015-11-25 19:04:28.935 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.7.1). 2015-11-25 19:04:33.928 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started 2015-11-25 19:04:34.310 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed. 2015-11-25 19:04:34.336 [INFO ] [.io.transport.mqtt.MqttService] - MQTT Service initialization completed. 2015-11-25 19:04:34.339 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'rpibroker' 2015-11-25 19:04:42.852 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'demo.sitemap' 2015-11-25 19:04:43.861 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'db4o.persist'

My demo.items file
Number Humi "Humidity: [%.2f]%" <humidity> (Balcony) {mqtt="<[rpibroker:home/master/humidity:state:default]"} Number Temp "Temperature [%.2f F]" <temperature> (Balcony) {mqtt="<[rpibroker:home/master/temperature:state:default]"}

My sitemap aka demo site which i added two items to
` Text label=“Group Demo” icon=“firstfloor” {
Switch item=Lights mappings=[OFF=“All Off”]
Group item=Heating
Group item=Windows
Text item=Temperature
Text item=Temp
Text item=Humi

	}`

Lastly, i do not see any MQTT updates or anything from my arduino in openhab events.log file. Any help would be greatly appreciated.

Here is openhab.cfg file:

mqtt:rpibroker.url=tcp://192.168.1.200:1883
mqtt:rpibroker.clientId=openhab

Beset Regards,
Carl

Do you need the clientId set in openhab.cfg? I haven’t set it in my implementation and have MQTT brokered MySensors data in OH without problem.

Maybe try without the mqtt:rpibroker.clientId=openhab and see?

I have a similar setup, and I don’t see anything wrong with your code having compared to mine, so I’m guessing the problem is elsewhere.

First, confirm the MQTT addon .jar file is in your addons directory - you’ll get those service started messages even without it, apparently. Next, confirm it’s permissions are correct. I had to chown my addons to openhab:openhab user whenever I installed one.

Do you have full debug logging enabled? If not, do that, then post a more full log to pastebin to examine. I’d also suggest stripping out demo content and starting from a new sitemap (remove demo items files and persistence), once you’ve confirmed the demo stuff is working as expected.

Thank you for the response; Really appreciate the input. Im not sure whats going on here, its a basic raspberry pi 2 MQTT/openhab controller. The MQTT broker is still unable to receive any messages from openhab. I went ahead an reinstalled openhab, this time not including the demo.sitemap. I am now using the home.sitemap code which i have posted below. I have added all binding’s to /addons running sudo chown -R openhab:openhab /etc/openhab.

Also, I commented out the mqtt CLIENTID in openhab.cfg. Looks like a default ID is generated during startup.

lastly, i have confirmed and tested that MQTT broker is running by sending topic/message from mac via MQTT.fx application.

items:
pi@raspberrypi /etc/openhab $ cat configurations/items/home.items
Switch mqttsw1 “Switch 1” (all) {mqtt=">[rpibroker:/testsw/1:command:on:default],>[rpibroker:/testsw/1:command:off:default]"}
Switch mqttsw2 “Switch 2” (all) {mqtt=">[rpibroker:/testsw/2:command:off:default],>[rpibroker:/testsw/2:command:on:default]"}

sitemap:
pi@raspberrypi /etc/openhab $ cat configurations/sitemaps/home.sitemap
sitemap demo label=“House”
{

Frame label=“Master”
{
Switch item=mqttsw1 label=“MQTT Switch 1”
Switch item=mqttsw2 label=“MQTT Switch 2”
}

}

LOG with Debug=yes
`10:17:11.823 [DEBUG] [.s.internal.SchedulerActivator:36 ] - Scheduler has been started.
10:17:12.050 [INFO ] [uartz.impl.StdSchedulerFactory:1175 ] - Using default implementation for ThreadExecutor
10:17:12.159 [INFO ] [rtz.core.SchedulerSignalerImpl:61 ] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
10:17:12.162 [INFO ] [rg.quartz.core.QuartzScheduler:243 ] - Quartz Scheduler v.2.1.7 created.
10:17:12.171 [INFO ] [org.quartz.simpl.RAMJobStore :154 ] - RAMJobStore initialized.
10:17:12.179 [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.

10:17:12.181 [INFO ] [uartz.impl.StdSchedulerFactory:1324 ] - Quartz scheduler ‘openHAB-job-scheduler’ initialized from specified file: ‘/etc/openhab/quartz.properties’
10:17:12.183 [INFO ] [uartz.impl.StdSchedulerFactory:1328 ] - Quartz scheduler version: 2.1.7
10:17:12.186 [INFO ] [rg.quartz.core.QuartzScheduler:534 ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.
10:17:12.206 [DEBUG] [o.config.core.ConfigDispatcher:146 ] - Processing openHAB default configuration file ‘/usr/share/openhab/configurations/openhab_default.cfg’.
10:17:12.873 [DEBUG] [o.config.core.ConfigDispatcher:168 ] - Processing openHAB main configuration file ‘/etc/openhab/configurations/openhab.cfg’.
10:17:13.064 [DEBUG] [.o.core.internal.CoreActivator:93 ] - UUID file already exists at ‘/usr/share/openhab/webapps/static/uuid’ with content ‘03d69aca-263c-4183-91ea-6d56f3d40827’
10:17:13.071 [DEBUG] [.o.core.internal.CoreActivator:115 ] - Created file ‘/usr/share/openhab/webapps/static/version’ with content ‘1.7.1’
10:17:13.073 [INFO ] [.o.core.internal.CoreActivator:61 ] - openHAB runtime has been started (v1.7.1).
10:17:13.201 [DEBUG] [a.internal.AutoUpdateActivator:31 ] - AutoUpdate binding has been started.
10:17:17.979 [DEBUG] [.p.i.PersistenceModelActivator:23 ] - Registered ‘persistence’ configuration parser
10:17:18.095 [DEBUG] [.c.t.i.TransformationActivator:38 ] - Transformation Service has been started.
10:17:18.260 [DEBUG] [m.internal.MultimediaActivator:34 ] - Multimedia I/O bundle has been started.
10:17:18.350 [DEBUG] [.s.i.DiscoveryServiceActivator:27 ] - Discovery service has been started.
10:17:18.371 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl:93 ] - mDNS service has been started
10:17:18.435 [DEBUG] [.io.transport.mqtt.MqttService:123 ] - Starting MQTT Service…
10:17:18.762 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl:53 ] - Service Discovery initialization completed.
10:17:18.781 [INFO ] [.io.transport.mqtt.MqttService:108 ] - MQTT Service initialization completed.
10:17:18.784 [INFO ] [o.i.t.m.i.MqttBrokerConnection:114 ] - Starting MQTT broker connection ‘rpibroker’
10:17:18.830 [DEBUG] [o.i.t.m.i.MqttBrokerConnection:294 ] - Creating new client for ‘tcp://localhost:1883’ using id ‘openhab.1448637438820’ and file store ‘/tmp/rpibroker’
10:17:19.438 [DEBUG] [.i.internal.ItemModelActivator:24 ] - Registered ‘item’ configuration parser
10:17:19.921 [DEBUG] [o.o.c.i.items.ItemRegistryImpl:137 ] - Item provider ‘GenericItemProvider’ has been added.
10:17:23.075 [DEBUG] [.o.m.s.i.SitemapModelActivator:23 ] - Registered ‘sitemap’ configuration parser
10:17:23.473 [DEBUG] [io.rest.internal.RESTActivator:33 ] - REST API has been started.
10:17:23.746 [INFO ] [org.atmosphere.util.IOUtils :370 ] - META-INF/services/org.atmosphere.cpr.AtmosphereFramework not found in class loader
10:17:23.899 [INFO ] [sphere.cpr.AtmosphereFramework:2601 ] - Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
10:17:23.904 [INFO ] [cpr.DefaultAnnotationProcessor:138 ] - AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$BytecodeBasedAnnotationProcessor being used
10:17:24.017 [WARN ] [cpr.DefaultAnnotationProcessor:178 ] - Unable to detect annotations. Application may fail to deploy.
10:17:24.265 [INFO ] [sphere.cpr.AtmosphereFramework:1891 ] - Auto detecting atmosphere handlers /WEB-INF/classes/
10:17:24.355 [INFO ] [sphere.cpr.AtmosphereFramework:639 ] - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path /* and Broadcaster Class org.atmosphere.jersey.JerseyBroadcaster
10:17:24.357 [INFO ] [sphere.cpr.AtmosphereFramework:1945 ] - Auto detecting WebSocketHandler in /WEB-INF/classes/
10:17:24.363 [INFO ] [sphere.cpr.AtmosphereFramework:1602 ] - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
10:17:24.507 [INFO ] [.a.h.ReflectorServletProcessor:103 ] - Installing Servlet com.sun.jersey.spi.container.servlet.ServletContainer
10:17:25.066 [INFO ] [c.s.j.s.i.a.WebApplicationImpl:815 ] - Initiating Jersey application, version ‘Jersey: 1.18.1 02/19/2014 03:28 AM’
10:17:25.077 [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
10:17:25.342 [INFO ] [j.s.i.a.DeferredResourceConfig:101 ] - Instantiated the Application class org.openhab.io.rest.RESTApplication
10:17:27.601 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘home.sitemap’
10:17:31.487 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model ‘home.items’
10:17:31.577 [DEBUG] [i.internal.GenericItemProvider:154 ] - Processing binding configs for items from model ‘home.items’
10:17:31.586 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model ‘home.items’
10:17:32.974 [INFO ] [sphere.cpr.AtmosphereFramework:2435 ] - AtmosphereInterceptor CORS Interceptor Support will always be executed first
10:17:32.976 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor CORS Interceptor Support with priority FIRST_BEFORE_DEFAULT
10:17:32.980 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Default Response’s Headers Interceptor with priority AFTER_DEFAULT
10:17:32.987 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Android Interceptor Support with priority AFTER_DEFAULT
10:17:32.993 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor SSE Interceptor Support with priority AFTER_DEFAULT
10:17:32.997 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor JSONP Interceptor Support with priority AFTER_DEFAULT
10:17:33.004 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Atmosphere JavaScript Protocol with priority AFTER_DEFAULT
10:17:33.008 [INFO ] [sphere.cpr.AtmosphereFramework:2404 ] - Installed AtmosphereInterceptor Browser disconnection detection with priority AFTER_DEFAULT
10:17:33.026 [INFO ] [sphere.cpr.AtmosphereFramework:935 ] - Using EndpointMapper class org.atmosphere.util.DefaultEndpointMapper
10:17:33.032 [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
10:17:33.034 [INFO ] [sphere.cpr.AtmosphereFramework:949 ] - Default Broadcaster Class: org.atmosphere.jersey.JerseyBroadcaster
10:17:33.037 [INFO ] [sphere.cpr.AtmosphereFramework:950 ] - Broadcaster Polling Wait Time 100
10:17:33.040 [INFO ] [sphere.cpr.AtmosphereFramework:951 ] - Shared ExecutorService supported: true
10:17:33.043 [INFO ] [sphere.cpr.AtmosphereFramework:958 ] - Messaging Thread Pool Size: 10
10:17:33.045 [INFO ] [sphere.cpr.AtmosphereFramework:968 ] - Async I/O Thread Pool Size: 10
10:17:33.047 [INFO ] [sphere.cpr.AtmosphereFramework:979 ] - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
10:17:33.052 [INFO ] [sphere.cpr.AtmosphereFramework:980 ] - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
10:17:33.054 [INFO ] [sphere.cpr.AtmosphereFramework:990 ] - Invoke AtmosphereInterceptor on WebSocket message true
10:17:33.056 [INFO ] [sphere.cpr.AtmosphereFramework:991 ] - HttpSession supported: false
10:17:33.059 [INFO ] [sphere.cpr.AtmosphereFramework:993 ] - Atmosphere is using DefaultAtmosphereObjectFactory for dependency injection and object creation
10:17:33.062 [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.
10:17:33.069 [INFO ] [sphere.cpr.AtmosphereFramework:996 ] - Atmosphere Framework 2.2.5 started.
10:17:33.071 [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

10:17:33.075 [INFO ] [penhab.io.rest.RESTApplication:144 ] - Started REST API at /rest
10:17:33.082 [DEBUG] [o.o.i.s.i.DiscoveryServiceImpl:66 ] - Registering new service _openhab-server._tcp.local. at port 8080
10:17:33.338 [INFO ] [sphere.cpr.AtmosphereFramework:1053 ] - Latest version of Atmosphere’s JavaScript Client 2.2.12
10:17:33.340 [INFO ] [sphere.cpr.AtmosphereFramework:1060 ] -

Atmosphere Framework Updates
Minor available (bugs fixes): 2.2.8
Major available (new features): 2.4.1

10:17:35.799 [DEBUG] [o.o.i.s.i.DiscoveryServiceImpl:66 ] - Registering new service _openhab-server-ssl._tcp.local. at port 8443
10:17:39.725 [INFO ] [.o.u.w.i.servlet.WebAppServlet:79 ] - Started Classic UI at /openhab.app
10:17:41.087 [DEBUG] [.r.internal.RuleModelActivator:42 ] - Registered ‘rules’ configuration parser
10:17:41.133 [DEBUG] [m.r.internal.engine.RuleEngine:77 ] - Started rule engine`

Thanks again for the help. After doing some more research on my own i came across an article which went over installing addons via apt-get. After installed mqtt via apt-get, my mqtt broker was able to read message from openhab. PS. i also still have addons installed in the openhab folder.

Raspberry Pi Debian install MQTT addon:
sudo apt-get install openhab-addon-binding-mqtt