Hi,
Well today I reinstalled Raspbian, MQTT and Openhab.
And now I have different results on openhab logs , but i think that continue without working. These are the logs:
osgi> 2016-07-11 20:37:00.638 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.8.3).
2016-07-11 20:37:03.470 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2016-07-11 20:37:03.608 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2016-07-11 20:37:03.621 [INFO ] [.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2016-07-11 20:37:03.623 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'broker’
2016-07-11 20:37:08.980 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2016-07-11 20:37:12.565 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'test1.sitemap’
2016-07-11 20:37:13.342 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'logging.persist’
2016-07-11 20:37:13.404 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'exec.persist’
2016-07-11 20:37:13.425 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'db4o.persist’
2016-07-11 20:37:13.440 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist’
2016-07-11 20:37:13.562 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'demo.script’
2016-07-11 20:37:13.834 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'test1.items’
2016-07-11 20:37:14.416 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /classicui/openhab.app
2016-07-11 20:37:19.038 [INFO ] [.service.AbstractActiveService] - HTTP Refresh Service has been started
2016-07-11 20:37:19.073 [INFO ] [.service.AbstractActiveService] - NTP Refresh Service has been started
2016-07-11 20:37:19.090 [WARN ] [o.p.m.i.MqttPersistenceService] - mqtt-persistence:broker
2016-07-11 20:37:19.091 [WARN ] [o.p.m.i.MqttPersistenceService] - mqtt-persistence:topic
2016-07-11 20:37:19.092 [WARN ] [o.p.m.i.MqttPersistenceService] - mqtt-persistence:message
2016-07-11 20:37:19.160 [INFO ] [.p.rrd4j.internal.RRD4jService] - Removing invalid defintion component = null heartbeat = 0 min/max = 0.0/0.0 step = 0 0 archives(s) = [] 0 items(s) = []
2016-07-11 20:37:57.709 [INFO ] [runtime.busevents ] - lamp1 received command ON
As you can see in last line, by openhab website i switched on lamp, but in topic where i’m subscribed, i don’t see anything.
This is de openhab.cfg transport configuration:
#######################################################################################
Transport configurations
#######################################################################################
################################# MQTT Transport ######################################
Define your MQTT broker connections here for use in the MQTT Binding or MQTT
Persistence bundles. Replace with a id you choose.
URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
#mqtt:.url=tcp://:1883
mqtt:broker.url=tcp://localhost:1883
Optional. Client id (max 23 chars) to use when connecting to the broker.
If not provided a default one is generated.
#mqtt:.clientId=
mqtt:broker.clientId=openhab
Optional. User id to authenticate with the broker.
mqtt:.user=
Optional. Password to authenticate with the broker.
#mqtt:.pwd=
Optional. Set the quality of service level for sending messages to this broker.
Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
(Deliver exactly once). Defaults to 0.
#mqtt:.qos=
Optional. True or false. Defines if the broker should retain the messages sent to
it. Defaults to false.
#mqtt:.retain=
mqtt:broker.retain=true
Optional. True or false. Defines if messages are published asynchronously or
synchronously. Defaults to true.
#mqtt:.async=
Optional. Defines the last will and testament that is sent when this client goes offline
Format: topic:message:qos:retained
#mqtt:.lwt=
I dunno, but before i reinstalled openhab i’m not sure that if folder addons was empty. Now after reintall i have these files in addons folder:
org.openhab.action.mqtt-1.8.3.jar
org.openhab.binding.http-1.8.3.jar
org.openhab.binding.mqtt-1.8.3.jar
org.openhab.binding.ntp-1.8.3.jar
org.openhab.persistence.exec-1.8.3.jar
org.openhab.persistence.logging-1.8.3.jar
org.openhab.persistence.mqtt-1.8.3.jar
org.openhab.persistence.rrd4j-1.8.3.jar
These are the item and sitemap of my example:
item
Group All
Switch mqttsw1 “Switch 1” (all) {mqtt=">[broker:/testsw/1:command:on:1],>[broker:/testsw/1:comma
nd:off:0]"}
Switch mqttsw2 “Switch 2” (all) {mqtt=">[broker:/testsw/2:command:off:0],>[broker:/testsw/2:comm
and:on:1]"}
Switch lamp1 “Office Lamp” (all){mqtt=">[broker:/casa/terraza/nodemcu1/p1/com:command:1:ON],>[br
oker:/casa/terraza/nodemcu1/p1/com:command:0:OFF],<[broker:/casa/terraza/nodemcu1/p1/state:state
:default]"}
sitemap
sitemap test1 label=“Main Menu”
{
Frame label=“MQTT” {
Switch item=mqttsw1 label="MQTT Switch 1"
Switch item=mqttsw2 label="MQTT Switch 2"
Switch item=lamp1 label=“Office Lamp”
}
}
And as you can see nothing is published in topic /casa/# when i switch on/off lamp1, but status appears in openhab log as you can see above.
mosquitto_sub -d -t /casa/#
Client mosqsub/6435-raspberryp sending CONNECT
Client mosqsub/6435-raspberryp received CONNACK
Client mosqsub/6435-raspberryp sending SUBSCRIBE (Mid: 1, Topic: /casa/#, QoS: 0)
Client mosqsub/6435-raspberryp received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/6435-raspberryp sending PINGREQ
Client mosqsub/6435-raspberryp received PINGRESP
thanks again.