does openHAB establish a stable connection to the mosquitto now?
check with
lsof -i :1883
netstat -atn |grep 1883
monitor also the mosquitto.log file
does openHAB establish a stable connection to the mosquitto now?
check with
lsof -i :1883
netstat -atn |grep 1883
monitor also the mosquitto.log file
i think not?
[10:39:57] openhabian@openHABianPi:/etc/openhab2$ sudo lsof -i :1883
[sudo] password for openhabian:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mosquitto 438 mosquitto 4u IPv4 10339 0t0 TCP *:1883 (LISTEN)
mosquitto 438 mosquitto 5u IPv4 6942 0t0 TCP openHABianPi.fritz.box:1883->sonoff1-3424.fritz.box:9590 (ESTABLISHED)
mosquitto 438 mosquitto 6u IPv4 6984 0t0 TCP localhost:1883->localhost:43550 (ESTABLISHED)
java 907 openhab 127u IPv6 12652 0t0 TCP localhost:43550->localhost:1883 (ESTABLISHED)
[10:40:11] openhabian@openHABianPi:/etc/openhab2$ sudo netstat -atn |grep 1883
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN
tcp 0 0 192.168.178.173:1883 192.168.178.160:9590 ESTABLISHED
tcp 0 0 127.0.0.1:1883 127.0.0.1:43550 ESTABLISHED
tcp6 0 0 127.0.0.1:43550 127.0.0.1:1883 ESTABLISHED
looks good and clean ! does it work?
You have only the needed connections listed:
mosquitto 438 mosquitto 4u IPv4 10339 0t0 TCP *:1883 (LISTEN)
mosquitto listening to the world
mosquitto 438 mosquitto 5u IPv4 6942 0t0 TCP openHABianPi.fritz.box:1883->sonoff1-3424.fritz.box:9590 (ESTABLISHED)
mosquitto link with sonoff
mosquitto 438 mosquitto 6u IPv4 6984 0t0 TCP localhost:1883->localhost:43550 (ESTABLISHED)
mosquitto link to openhab (only 1!.. thatâs good)
java 907 openhab 127u IPv6 12652 0t0 TCP localhost:43550->localhost:1883 (ESTABLISHED)
openhab link (only 1!) to mosquitto (donât ask me why it appears as IPv6 and not IPv4 as it should⊠)
Iâll do these steps later today (Iâve deinstalled and installed MQTT Action), but Iâd like to ask:
which file log can I see the MQTT Action publish command?? I looked at openhab log /mosquitto.log and even if I move the switch nothing appears at this logâŠ
Paulo
no
switching from tasmota/sonoff1 webinterface does this:
[16:38:06] openhabian@openHABianPi:~$ mosquitto_sub -v -t 'tasmota/#'
tasmota/sonoff1/tele/LWT Online
tasmota/sonoff1/stat/RESULT {"POWER":"ON"}
tasmota/sonoff1/stat/POWER ON
tasmota/sonoff1/stat/RESULT {"POWER":"OFF"}
tasmota/sonoff1/stat/POWER OFF
switching with openhab does nothing von âmosquitto_sub -v -t âtasmota/#ââ:
openhab.log
2017-07-23 16:39:53.140 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to tasmota/sonoff1/cmnd/POWER
events.log
2017-07-23 16:39:53.122 [ItemCommandEvent ] - Item 'Sonoff_TH16A' received command ON
2017-07-23 16:39:53.144 [ItemStateChangedEvent ] - Sonoff_TH16A changed from NULL to ON
nothing on mosquitto.log
1500820404: New connection from 192.168.178.160 on port 1883.
1500820404: New client connected from 192.168.178.160 as OH2MQTT (c1, k15, u'DVES_USER').
1500820456: New connection from 127.0.0.1 on port 1883.
1500820456: New client connected from 127.0.0.1 as openHAB2 (c1, k60).
1500820699: New connection from 127.0.0.1 on port 1883.
no need for the action binding?
It should be in your mosquitto.log if your setup is working:
1500783927: New connection from 192.168.2.181 on port 1883.
1500783927: New client connected from 192.168.2.181 as ESPClient1 (c1, k15).
1500783927: Sending CONNACK to ESPClient1 (0, 0)
1500783927: Received SUBSCRIBE from ESPClient1
1500783927: /esp8266one/# (QoS 0)
1500783927: ESPClient1 0 /esp8266one/#
1500783927: Sending SUBACK to ESPClient1
1500783927: Sending PUBLISH to ESPClient1 (d0, q0, r1, m0, '/esp8266one/dht22/temperature', ... (4 bytes))
1500783927: Sending PUBLISH to ESPClient1 (d0, q0, r1, m0, '/esp8266one/dht22/humidity', ... (3 bytes))
1500783927: Sending PUBLISH to ESPClient1 (d0, q0, r1, m0, '/esp8266one/light/intensity', ... (2 bytes))
At the log I got the connection message but no subscriptionâŠ
1500815962: mosquitto version 1.4.14 (build date Mon, 10 Jul 2017 23:48:43 +0100 ) starting
1500815962: Config loaded from /etc/mosquitto/mosquitto.conf.
1500815962: Opening ipv4 listen socket on port 1883.
1500815980: New connection from 10.0.0.104 on port 1883.
1500815980: New client connected from 10.0.0.104 as DVES_A7F83D (c1, k15, uâopen habianâ).
1500816043: New connection from 127.0.0.1 on port 1883.
1500816043: New client connected from 127.0.0.1 as openHAB2 (c1, k60, uâopenhabi anâ).
if I subscribe to the topic and send a message from MQTT.fx should I turn on/off the lamp?? Because I tried to do that and it doesnât work tooâŠ
Yes, I have uninstalled it and installed againâŠ
Result:
Pid: org.openhab.mqtt
BundleLocation: mvn:org.openhab.io/org.openhab.io.transport.mqtt/1.10.0
Properties:
raspberrypi.clientId = openHAB2
raspberrypi.pwd = password
raspberrypi.url = tcp://127.0.0.1:1883
raspberrypi.user = openhabian
service.pid = org.openhab.mqtt
openhab> config:list |grep -i broker
broker = raspberrypi
broker = raspberrypi
Iâm testing the MQTT using MQTT fx. If I publish using MQTT fx, I can see the result at subscribe, but nothing appears at Sonoff. Same thing with Sonoff, the device sends messages from time to time but MQTT.fx doesnât see themâŠ
no real need for the MQTT Action addon (unless you want to create rules that publish stuff to the broker like: publish(String brokerName, String topic, String message)
)
you item config should look like:
Switch Sonoff_TH16A "Sonoff Test" <light> { mqtt=">[mqttson:tasmota/sonoff1/cmnd/POWER:command:*:default],<[mqttson:tasmota/sonoff1/stat/POWER:state:default]" }
with mqtt.cfg:
mqttson.url=tcp://127.0.0.1:1883
mqttson.clientId=openHAB2
this means that the openHAB2 â Broker connection is (still) not working⊠(without any obvious reasonâŠ)
i you were me, you wouldnât - trust me
look at this
every item is configured with âbrokerâ -but it sould be âmqttsonâ: this i the connection between items and mqtt.cfg. seems pretty obvious, now that i see your definition of items.
iâll re-configure my items as soon as iâm home!
by the way: @ThomDietrich 's link to https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB#requirements gives you all the info that you need (maybe with a small exception of a sample mqtt.cfg).
It is mentioned in that wiki entry that : â[âŠ] you first need to install and activate the MQTT bindingâ
Anyway, I believe that if you fix the item configs⊠it should work
(there were no errors logged in openhab.log due to the wrong broker item config?)
no, openhab.log shows no errors.
i began the whole project with ThomDietrichâs link, but as you know there were some problems⊠originally my first step was activating the mqtt binding =)
i stopped OH2 using systemctl stop deleted all the tmp and cache files, after that I started the service again. But since then (5 hours have passed) the message âPlease stand by while UIs are being installed. This can take several minutes.â still continuesâŠ
What shall I do now??
Paulo
including the tmp folder itself?
(if yes: recreate it⊠with the correct permissions like the other folders)
I just left the folders empty⊠can I do a sudo reboot??? will it affect the configuration??
yeah, you can reboot. It doesnât affect flat config files.
check the output of ls -al /var/lib/openhab2/
YAY!
for me itâs working now! just had to correct the broker on my items!
BIG thanks to @Dim !
In the end i donât know what exactly did the trick (besides correct items-definition), but after deleting so many configs iâm happy itâs working now!
nice
My only concern is that we didnât clearly identify the root cause, so donât know what to write in the open issue here:
I may have to close it since I canât provide steps to reproduce it
after shutdown OH2 is online again, but still things isnât working⊠Iâll try to do things smoothly in order to understand what it is happeningâŠ
BUT I see that although Sonoff is connecting even if I send mosquitto_pub to the topic nothing happens:
(Sonoff console)
00:00:00 APP: Project sonoff Sonoff (Topic sonoff-abajur, Fallback DVES_A7F83D, GroupTopic sonoffs) Version 5.2.1
00:00:00 Wifi: Connecting to AP1 Home in mode 11N as sonoff-abajur-6205âŠ
00:00:06 Wifi: Connected
00:00:06 mDNS: Initialized
00:00:06 HTTP: Webserver active on sonoff-abajur-6205.local with IP address 10.0.0.104
12:28:18 MQTT: Attempting connectionâŠ
12:28:19 mDNS: Query done with 0 mqtt services found
12:28:19 MQTT: Connected
12:28:19 MQTT: tasmota/sonoff-abajur/tele/LWT = Online (retained)
12:28:19 MQTT: tasmota/sonoff-abajur/cmnd/POWER =
12:28:19 MQTT: tasmota/sonoff-abajur/tele/INFO1 = {âModuleâ:âSonoff Basicâ, âVersionâ:â5.2.1â, âFallbackTopicâ:âDVES_A7F83Dâ, âGroupTopicâ:âsonoffsâ}
12:28:19 MQTT: tasmota/sonoff-abajur/tele/INFO2 = {âWebserverModeâ:âAdminâ, âHostnameâ:âsonoff-abajur-6205â, âIPaddressâ:â10.0.0.104â}
12:28:19 MQTT: tasmota/sonoff-abajur/tele/INFO3 = {âStartedâ:âPower onâ}
12:28:20 MQTT: tasmota/sonoff-abajur/stat/RESULT = {âPOWERâ:âOFFâ}
12:28:20 MQTT: tasmota/sonoff-abajur/stat/POWER = OFF
what does it mean " Query done with ZERO mqtt services found" ?
(Mosquitto log)
1500982093: Client DVES_A7F83D has exceeded timeout, disconnecting.
1500982093: Socket error on client DVES_A7F83D, disconnecting.
1500982098: New connection from 10.0.0.104 on port 1883.
1500982098: New client connected from 10.0.0.104 as DVES_A7F83D (c1, k15, uâopenhabianâ).
1500982341: New connection from 127.0.0.1 on port 1883.
(the second connection is from the mosquitto.fx)
Really donât know where to go nowâŠ
@Dim i donât know, either⊠just followed your insctructions and the problem(s) went awayâŠ