Hi,
I have a problem with MQQT connection and OpenHAB2. Everything seems to bee good MQQT broker running on PI3. I want to send data from Arduino sensors to OpenHAB. Till now I have data from DHT22 sensor posted to MQQT, but data is not visualized on Basic UI.I tried with switches too, just to see that messages are subscribed/posted unfortunately without success.
If I understood well when i change switch position message shall be posted or if I send command OFF or ON throug mosquitto_pub -t home/lights/in. Swtich position should be changed to OFF.
Every advice will be appreciated. Thanks in advance
Do you have an mqtt.cfg file, not mqqt.cfg as written?
Did you install the MQTT binding?
Do you see âStarting MQTT broker connection to âmosquittoââ in your logs?
Do you see any errors in the logs?
Do you see âNew client connected from <IP address> as openhab âŠâ in mosquitto logs?
Do you have an mqtt.cfg file, not mqqt.cfg as written? â What is the difference ? If i see correct name is same
Did you install the MQTT binding? A: Yes I have it already installed
Do you see âStarting MQTT broker connection to âmosquittoââ in your logs? A: Here is what is displayed in the log i think that there is something wrong in second message:
2017-08-30 21:51:44.805 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-08-30 21:51:44.805 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-08-30 21:51:44.917 [ERROR] [org.apache.felix.configadmin ] - Cannot use configuration org.openhab.mqtt for [org.openhab.core.scriptengine.action.ActionService, org.osgi.service.cm.ManagedService, id=345, bundle=209/mvn:org.openhab.action/org.openhab.action.mqtt/1.10.0]: No visibility to configuration bound to mvn:org.openhab.io/org.openhab.io.transport.mqtt/1.10.0
The MQTT binding is looking for a file called mqtt.cfg. If your file is named mqqt.cfg the MQTT binding will not find any configuration file, and that makes a huge difference,
Alright I think that connection is good because when i stop mosquitto this message is showed in the log:
2017-08-31 10:01:19.881 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to âmosquittoâ was lost: Connection lost : ReasonCode 32109 : Cause : Read timed out
But the problem still there is nothing in mosquitto_sub -v -t âhome/lights/inâ also when i try to publish something mosquitto_pub -v -t âhomeme/lights/inâ there is nothing happened in Basic UI
Now this is showed in log:
Line 3689: 2017-08-31 10:28:02.191 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type âmqttâ of item âSwitch1â could not be parsed correctly.
Line 3690: org.eclipse.smarthome.model.item.BindingConfigParseException: Invalid mqtt binding configuration âmosquitto:home/lights/in:state:ON:1â for item Switch1
Yes, I am afraid there was a typo in my text,
Glad it is now working, however, I think you still have a problem with the configuration of the inbound bindings.
From your example, I understand that your device (sitting at âthe other endâ of MQTT) uses â0â and â1â that you want to map to âOFFâ and âONâ in openHAB.
In this case you need to create a MAP transform (a file in the openHAB transform folder) as follows:
Name: my-mqtt-in.map
Content:
0=OFF
1=ON
Then you need to install the MAP transform (using Paper UI or cfg files), and finally use the MAP file in your item binding.
I already control the switch thanks a lot for help.
Now Iâm going on second stage. I want to display arduino sensor dht22 temperature in openhab i have information published already i think that when i add Number it will be fine