MQTT : publish failed

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kenmullins64
Normal user
Posts: 3
Joined: 16 Aug 2018, 12:01

MQTT : publish failed

#1 Post by kenmullins64 » 16 Aug 2018, 12:18

I've been struggling with this for a while. I'm using ESP_Easy_mega-20180507_dev_ESP8266_1024.bin on a Sonoff wifi smart switch and trying to send/receive MQTT messages to interface with Open Hab2.

I'm using MQTT.fx and MQTT spy to see the messages to/from. I can see messages coming from OH2 but nothing coming from or being consumed by ESPEasy.

I've tried connecting to my localhost:1883 via name and IP. I've tried connecting to test.mosquitto.org in case it was a localhost issue but all fail. I've tried with authentication and without.

I'm running everything on a Windows 8.1 install.

I'm just looking at the logs at the moment but may have to hook up the serial interface to see what is actually happening as the logs don't give a great deal of info. I've set the logs to debug dev.
10551: MQTT : publish failed
10551: MQTT : /ESP_Easy1/Status/uptime 0.00
The above 2 lines are all that I'm getting from the logs. There are no details about MQTT login errors.

I have cycled power after changes to the ESPEasy config with the same result. :-(

I presume this is something very simple as so many peeps have this working. I may have fallen from the dumb tree today and hit a number of the branches on the way down though. I have many years in Software Development so I should be able to resolve this but it would seem not. :roll:

Any and all help gladly accepted. :-)

TD-er
Core team member
Posts: 3390
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT : publish failed

#2 Post by TD-er » 16 Aug 2018, 21:35

What broker are you using? (or am I in need of new coffee and did you mention it? I did see test.mosquito.org )

As far as I can see MQTT.fx (I just installed it here to see what it was) is just a client.
So ESPeasy and OpenHab must both connect to the same broker (and also your MQTT.fx to see the messages)

And what topics do you try to subscribe to?
When using "#" as subscription, you get to see all messages sent through the broker.

kenmullins64
Normal user
Posts: 3
Joined: 16 Aug 2018, 12:01

Re: MQTT : publish failed

#3 Post by kenmullins64 » 17 Aug 2018, 03:04

Thanks for replying.

I'm using eclipse mosquito 3.1 as the broker. I thought mqtt.fx had it's own broker but I just found mosquito 3.1 running in the background from a previous attempt to get it running before moving to mqtt.fx.

I have been subscribing to all topics # locally and also narrowing the topics down when using a cloud broker (ESP_Easy1/#)

I'm only using the macro version of espeasy because the R120 wouldn't put my sonoff into AP mode (ESP_1). I also tried to upload the r120 using Arduino using the DOUT flash mode but it wouldn't compile. I could go back and blow away the Arduino install and do a fresh install and try and flash R120 again through Arduino if I can't get this macro version to fire.

All the messages below are coming from my OH2. 10.0.0.150 is my local Win 8.1 machine which is running everything (OH2, mosquito etc). I have tried using localhost instead of the IP with no luck.
mqtt.PNG
mqtt.PNG (27.25 KiB) Viewed 3201 times

kenmullins64
Normal user
Posts: 3
Joined: 16 Aug 2018, 12:01

Re: MQTT : publish failed

#4 Post by kenmullins64 » 17 Aug 2018, 03:47

I just reflashed a NodeMCU esp8266 that I have with r120 to see if I could see messages through that.

The install went fine and I can address it through the browser to turn an LED on/off (http://10.0.0.198/control?cmd=GPIO,13,1 http://10.0.0.198/control?cmd=GPIO,13,0) But it still won't talk to mosquito on 10.0.0.150?

This is doing my head in. I'm tempted to try TASMOTA to see if I can get any joy out of that :-(

This is what the serial log is telling me.
10 ps:44 uS 1 ps:55
WD : Uptime 9 ConnectFailures 34 FreeMem 28072
MQTT : Connection lost
MQTT : Failed to connected to broker
MQTT : Failed to connected to broker
FLASH: Settings saved
FLASH: Settings saved
WD : Uptime 9 ConnectFailures 36 FreeMem 26736
MQTT : Connection lost
MQTT : Failed to connected to broker
MQTT : Failed to connected to broker
SW : GPIO 0 Set to 1
WD : Uptime 10 ConnectFailures 38 FreeMem 27992
MQTT : Connection lost
MQTT : Failed to connected to broker
MQTT : Failed to connected to broker
Attachments
mqtt2.PNG
mqtt2.PNG (21.58 KiB) Viewed 3200 times

User avatar
ThomasB
Normal user
Posts: 738
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MQTT : publish failed

#5 Post by ThomasB » 17 Aug 2018, 04:18

I'm using OH2 (Openhabian on RPI) with ESPEasy. I was using R120 but have recently switch to the Mega Branch. Both branches work for me.

I am using the eclipse MQTT broker. The OH2's services mqtt.cfg has been configured with my broker info (mosquitto.url & mosquitto.clientId).

I see that your main settings page is missing the Controller User and Password. Just a reminder: Be sure to populate those two fields with your MQTT login.

- Thomas

waspie
Normal user
Posts: 119
Joined: 09 Feb 2017, 19:35

Re: MQTT : publish failed

#6 Post by waspie » 17 Aug 2018, 19:47

also, it sounds like you're trying to send commands *to* the esp via MQTT. you'll need the MQTT-Import plugin for that.
First you need to fix your other MQTT issues (see post above)

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests