daves1
(Ema)
April 30, 2017, 10:29am
1
Hi! I’m new here and I have problem with publishing data to openhab.
I’m using NodeMCU, temperature and humidity sensors and want to publish temperature and humidity to openhab but it doesn’t work.
Here is part of arduino code:
client.publish(“mySensor/temp”, shttChar);
client.publish(“mySensor/hum”, hChar);
This is Item:
Group All
Number Office_temperature “Temperature [%.1f °C]” {mqtt="<[broker:mySensor/temp:state:default]"}
Number Office_humidity “Humidity [%.1f]” {mqtt="<[broker:mySensor/hum:state:default]"}
Sitemap:
sitemap demo label=“Main Menu”
{
Frame label=“MQTT” {
Text item=Office_temperature
Text item=Office_humidity
}
}
Probably is some stupid mistake but I can’t find it, so I would appreciate if anybody could help.
sihui
(SiHui)
April 30, 2017, 11:04am
2
Your items definition looks fine, does your broker work?
daves1
(Ema)
April 30, 2017, 5:22pm
3
I tested it with mosquitto_sub -v -t ‘test/topic’ and mosquitto_pub -t ‘test/topic’ -m ‘helloWorld’ and everything seems fine. Don’t know what else could be problem. This is how my openhab looks like:
So, nothing is published and it should be…
sihui
(SiHui)
April 30, 2017, 8:08pm
4
Your broker seems to work (internally) and your mqtt definitions look fine.
So the only thing what could be missing: make sure your lua script publishes to the broker …
Dim
(Angelos)
April 30, 2017, 8:12pm
5
also, post your /etc/openhab2/services/mqtt.cfg
to check it
daves1
(Ema)
April 30, 2017, 10:03pm
6
broker.url=tcp://myIP:1883
broker.clientId=openhab
this is my mqtt.cfg, I think it’s fine. Is there any other document I need to change?
here is messages from logs:
2017-05-01 00:49:46.385 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to ‘broker’ was lost: Connection lost : ReasonCode 32109 : Cause : null
2017-05-01 00:49:46.385 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'broker’
2017-05-01 00:49:56.389 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker’
2017-05-01 00:50:05.251 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
sihui
(SiHui)
May 1, 2017, 6:22am
7
Do you have more than one client with the same id connected? See
Hi
I have one problem when i connect the sketch to network
my topology is the next
arduino 1+ ethenet sheld : 192.168.1.75
raspberry : 192.168.1.67
mosquitto
1474658886: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100) starting
1474658886: Using default config.
1474658886: Opening ipv4 listen socket on port 1883.
1474658886: Error: Address already in use
openhab
14:50:21.826 [INFO ] [uartz.impl.StdSchedulerFactory:1324 ] - Quartz scheduler ‘openHAB-job-scheduler’ …
daves1
(Ema)
May 1, 2017, 8:05pm
8
Okay, how to check if this is the problem and how to fix it?