Unable to subscribe to IoT topic (M5StickCPlus)
-
Hi all,
I've been trying to subscribe to an AWS IoT topic but with no success... even after searching for solution in this forum and on the internet. This is how the code looks like using UIFlow v1.11.9I can publish to topics without issues, but i'm unable to subscribe to topics :(
The data defined for label0 to label2 shows as 'none' and the label3 that i included on the AWS subscribe loop does not show at all. Which makes me wonder whether the subscribe commands is even done or whether it is done with error... although i do not see any errors when i run the code.
python code looks like this:
Anyone has faced this issue? is it a bug? Any help would be greatly appreciated.
Thanks -
You have a wificonnect block but haven't placed a wifi block to say what SSID and password to use to connect to the wifi network.
I have been getting some code fails when trying to decode JSON files, If I add the get key blocks as you have then it just doesn't work and wont even load the json stream.
-
Thanks for your feedback!
The wifi connects fine, because of the wifi config you burn via the M5burner I think. But you are right I can add that wifi block just in case.Update: I've tried with HiveMQ broker and the subscription PARTIALLY works: only the first message is received.
During the initial run (clicking run from the flow web UI), the code initializes then when publishing the first message to the topic via another client, the M5stick receive and display the message as expected. The get key part to get the values in the JSON data actually works fine if the message is received.However, the subsequent published messages to the topic are not received by the M5stick. I've tried to run the code under the subscribe block inside a loop but it doesn't work neither.
I've also tested EMQ broker and with a self hosted Mosquito broker, same results: only first message published is received. So it is likely something misconfigured or bugged on the M5 side ? I've now tried with 4 different brokers lol.
In the code, I've used the generic MQTT blocks this time instead of the AWS ones.
thanks for your help.
-
This is the code I'm using on a core2 that sends to a self hosted Mosquitto server and so far had no issues.and this is my M5Paper receiver code that retrieves data from the server.
-
@ajb2k3 I've physically restarted the device (power OFF and back ON with the side button) instead of just having it run / reset from the flow web ui, now it seems to work (with HiveMQ, i haven't re-tried the other yet)!
Thanks a lot for your support and for sharing your code, much appreciated !