Problem publishing to the MQTT bus with ESP8266

Hi there,

our new member @georges.gagliano (welcome!) currently experiences problems with MQTT publishing. He uses the Basic WiFi/MQTT sensor node firmware aka. node-wifi-mqtt.ino and doesn’t receive any data when subscribing to the MQTT bus on a local broker using "mosquitto_sub -t '#' -v". Bummer.

Maybe we can find the root cause for the problem together?

Cheers,
Andreas.

Could you share your firmware configuration (lines 104-247 of node-wifi-mqtt.ino) with us, @georges.gagliano? If it contains sensitive information, please redact it or send it to me using a private message (PM).

You might also want to share more details about the ESP8266 board or your overall system which might help us to assist you properly.

Thanks!

I can remember problems with MQTT topics or payloads being too long, see also Problem sending long MQTT payloads with Adafruit MQTT library and Warum gehen auf dem ESP8266 nur kurze MQTT Topics?.

So, may i humbly ask how long the topic and/or payload might actually be you are trying to publish? It might help to play around with some code modifications for trying to reduce the overall MQTT payload per publishing event, topic- as well as payload-wise.

Otherwise, i am currently out of ideas. Good luck and please let us know if you can achieve any progress.

Dear Georges,

it looks like you already made it, right? Or was it just testing!?

MQTT Bus

root@raspberry:~# mosquitto_sub -t '#' -v
example/test/site1/node1/data.json {"temperature": 50, "humidity": 70}

kotori.log

tail -F /var/log/kotori/kotori.log
2018-04-27T22:08:49+0200 [kotori.daq.graphing.grafana        ] INFO: Provisioning Grafana for database "example_test" and measurement "site1_node1_sensors". dashboard=example test automatic
2018-04-27T22:08:49+0200 [kotori.daq.graphing.grafana        ] INFO: Checking/Creating datasource "example_test"
2018-04-27T22:08:50+0200 [kotori.daq.graphing.grafana        ] INFO: Getting dashboard "example-test-automatic"
2018-04-27T22:08:50+0200 [kotori.daq.services.mig            ] INFO: [example] transactions: 0.50 tps
2018-04-27T22:08:50+0200 [kotori.daq.graphing.grafana        ] INFO: No missing panels to add

Do you see any data arriving in Grafana, actually?

With kind regards,
Andreas.

Hi
I make some test and i think that Kotori is the problem. Y say that because mosquitto, influxdb and Grafana work.
What must i do to unistall Kotori properly to try to reinstall ?

HI
Does any one have a MQTT broker online to test my ESP8266 ?

Can you install a local MQTT Mosquitto on a second machine to test? I have found this overviews with a Google search 8 Online MQTT Brokers: Your IoT (Connected Objects) in the Cloud • DIY Projects

Dear Georges,

Let’s first assure ourselves the measurements are actually arriving at the MQTT bus originating from the ESP8266.

You can well use just our broker at swarm.hiveeyes.org. While there are some ACLs in place, you can publish to the topic "hiveeyes/testdrive/..." without authentication.

Good luck!

With kind regards,
Andreas.

Hi there,

this is what i am getting from the debug output of the ESP:

19810 - INFO: wifi_connect | Connecting to WiFi 
19917 - INFO: wifi_connect | Checking for WiFi connection in 1.50seconds
21418 - INFO: wifi_connect | Checking for WiFi connection in 1.50seconds
26397 - INFO: wifi_connect | WiFi connected. IP address: 10.27.1.149
26398 - INFO: mqtt_connect | Connecting to MQTT broker 
26428 - INFO: mqtt_connect | Successfully connected to MQTT broker 10.27.1.110
26481 - INFO: read_temperature_array | Read temperature array (DS18B20) 
27572 - INFO: read_battery_level | Battery ADC:  793
27572 - INFO: read_battery_level | Battery level:  115%
27573 - INFO: transmit_readings | MQTT publish succeeded {"broodtemperature":22.75,"battery_level":115}
27665 - INFO: duty | Going to deep sleep mode for 300second

Maybe this helps for finding the issue i am having.

I don’t see MQTT_TOPIC appearing. Is this the problem?

Regards,
Georges.

Dear Andreas,

i am a bit embarrassed to admit i found a problem with my router. After replacing my new Linksys smartwifi by a WRT54GL all starts working fine. Remains to find why the other router is blocking the flow.

Regards,
Georges.

Dear Georges,

no worries, we are happy you have been able to find and resolve the problem. We were running out of ideas as the debug output of the firmware also looked reasonably. We know from our work that the culprit is almost always the cable ;], so let’s just blame Murphy.


Yes, strange thing. I can’t believe it will just block port 1883 right away. Maybe others here have an idea why this could happen. I am assuming the router just worked well for other traffic crossing it?

Does measurement data actually arrive in Grafana right now? Good luck for continuing your endeavors!

With kind regards,
Andreas.

Could it be a WiFi mode problem, see After a few messages wifi reconnects... · Issue #53 · tuanpmt/esp_mqtt · GitHub

In fact, the problem was the wifi security ?!
Wifi security was configured on WPA2. In this position the esp8266 see the broker but could not transmit the values. By disabling wifi security, esp8266 can publish the values. Why ?? i don’t now.