esp-mdf mqtt cannot subscribe topic

sapparatus
Posts: 5
Joined: Sun Nov 01, 2020 4:36 pm

esp-mdf mqtt cannot subscribe topic

Postby sapparatus » Mon Nov 16, 2020 2:39 am

Using the example in esp-mdf mqtt, the publish topic works fine but when you try to subscribe a topic, the payload does not come to the mesh, the root node seems no knowledge about there is a topic it subscribed, e.g. "mesh/ffffffffffff/toDevice" topic but none of the mesh node receives anything?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby PeterR » Mon Nov 16, 2020 4:45 pm

in esp-mdf mqtt, the publish topic works fine
What makes you think that publish worked fine? Guess you are QoS0?
but when you try to subscribe a topic, the payload does not come to the mesh
What return code did you get from esp_mqtt_client_subscribe()?

You have not told us anything about your MQTT server. Do you have an MQTT server & if so which one & where?
& I also believe that IDF CAN should be fixed.

sapparatus
Posts: 5
Joined: Sun Nov 01, 2020 4:36 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby sapparatus » Tue Nov 17, 2020 5:17 am

I have an internal mqtt server that receives all mesh messages from all nodes

on the root node, I put some lines so i see it is subscribing topics:


I (13052) [MESH_MQTT, 241]: =============== mymesh/b4e62db8661d/toDevice subscribed ==============================
I (13060) [MESH_MQTT, 246]: =============== mymesh/ffffffffffff/toDevice subscribed ==============================
I (13071) [MESH_MQTT, 251]: =============== mymesh/ff0000010000/toDevice subscribed ==============================
I (13081) [MYMESH, 331]: MQTT Topic subscribed

but when you send message to these topics, none is responding with "Node receives:"

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby PeterR » Tue Nov 17, 2020 12:42 pm

It is not clear what you mean. The new line without full stop makes the two first lines unclear. Are you saying that your root node is the MQTT server? Which MQTT server did you use?

Also produce a log of one of the ESP MQTT client's setup & return status codes.

Did you esp_mqtt_client_register_event()?
& I also believe that IDF CAN should be fixed.

clif123
Posts: 4
Joined: Thu Nov 19, 2020 1:44 am

Re: esp-mdf mqtt cannot subscribe topic

Postby clif123 » Fri Nov 20, 2020 8:11 pm

I'm interested in knowing if anyone has gotten the ESP-MDF MQTT example to work out of the box. I tried both the 1.0 and master from a few days ago with no success. Specifically, the root node obtained an IP address on the router but no MQTT traffic ever flowed over the router's network. I posted all my details here: viewtopic.php?f=2&t=18176

TL;DR I monitored all network traffic for an AP dedicated to this test and only observed DHCP and ARP traffic from the ESP32 that was the root node. I've had better luck with the IDF for network routing and mesh seems to work fine on MDF framework but I cannot get MESH + WLAN gateway scenarios to work.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby PeterR » Sun Nov 22, 2020 11:21 pm

I did over WS.
There were/are issues, check my posts, as I recall does not like fragmentation. ESP were very helpful & offered some patches.
In the end I cut the local ESP client out as was also quite laggy over WS so moved past the ESP32 MQTT client thing.

But, I am still not sure where/what you're mqtt server is? Try the HiveMq client. If you cannot get that the publish/subscribe then chances are its your server (or lack of).
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby PeterR » Sun Nov 22, 2020 11:35 pm

Ok, seen you're other post. I am guessing that you have a managed switch & you have enabled port mirroring?
You have actual transport errors logged so it should be possible (probably painful) to debug those clues.
& I also believe that IDF CAN should be fixed.

clif123
Posts: 4
Joined: Thu Nov 19, 2020 1:44 am

Re: esp-mdf mqtt cannot subscribe topic

Postby clif123 » Mon Nov 23, 2020 4:34 am

My test fixture was simply a high-speed hub connected to a simple access point. I monitored it there after not seeing anything but DHCP and ARPs over the main WiFi AP with a monitor point at the MQTT server. You would think that the example would just work out of the box right? ;)

clif123
Posts: 4
Joined: Thu Nov 19, 2020 1:44 am

Re: esp-mdf mqtt cannot subscribe topic

Postby clif123 » Mon Nov 23, 2020 1:44 pm

PeterR wrote:
Sun Nov 22, 2020 11:21 pm
I did over WS.
There were/are issues, check my posts, as I recall does not like fragmentation. ESP were very helpful & offered some patches.
In the end I cut the local ESP client out as was also quite laggy over WS so moved past the ESP32 MQTT client thing.

But, I am still not sure where/what you're mqtt server is? Try the HiveMq client. If you cannot get that the publish/subscribe then chances are its your server (or lack of).
Peter, you said that you cut out the MQTT client. What alternative did you use. I'm finding that I have good success using just the IDF and MQTT but I have not performed any long-term performance tests yet. Most of my existing projects have used the ESP8266, which appears more mature after wide adoption. I was excited about the possibility of using the mesh framework to offload the main WiFi network but this may just be too immature to rely on. To your other comment, I will dig around in the code and see if I can find the root cause to my network errors as ESP has not responded to my posts yet. I found the patch you referred to and will see if those changes could affect my success. Thanks for help!

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: esp-mdf mqtt cannot subscribe topic

Postby PeterR » Mon Nov 23, 2020 4:50 pm

I was using the ESP client (WS) to talk to my ESP WS MQTT server. Both client & server were on the same ESP. Other computers could also access the server. There were a range of issues in the local transport and the local ESP client. Also the client was laggy. I stripped the client out as I could just expose procedural calls within my server. This ran faster and with less ram & I did not have to debug as much!
I don't think that above helps you much. The WS server & client transport were sensitive to fragmentation as I recall & the patches in the post seem to resolve. There was also an issue with WS subprotocols (Chrome) which again seems to have a working patch.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot] and 201 guests