Subscribing to MQTT doesn't work
-
Hi everyone
I'm new to m5stacks and uiFlow and hope someone could help me.
I want my m5stack to subscribe to the MQTT Topic of my smart mailbox and react somehow when a letter was delivered. I use Mosquitto as my broker which is an addon to Home Assistant.
As a quick test I did the following in uiFlow. I want the RGB turn green when the payload "arrived" is picked up in the topic "mailbox/action".
The publish part works fine, I can pick up the readings of the ENV Unit inside Home Assistant. What doesn't work is the subscribe part, i can't pick up anything with my m5stack. If i subscribe to to the topic inside Home Assistant to check it, it works.
Thanks for letting me know if there is some error in the code or you know what else could be wrong.
-
What are you using to send the payload "arrived" to the mailbox/action topic?
Edit: never mind, now I see you published with mosquito in the second pic. I’m running the same setup, so let me do a test.
-
Thanks.
Yes, to test it I sent the payload via the publish feature inside HA. Of course, the goal would be, that the payload is sent by the esp32 in my mailbox (DFrobot Firebeetle). This is working fine, as I have other automations inside HA that react to the "arrived" payload. -
You can read through this thread to see some limitations with M5Stack and MQTT.
Do you know if HA Mosquitto adds the retain flag by default on publish?
-
I read some parts of this thread yesterday. ; ) I couldn't figure out whether the retain flag is set or not. But I tried it as well in the services tab where I set "retain: false" and it sadly didn't change a thing.
I thought that I probably have another problem, as most people in that thread only had problems with subscribing to multiple topics, no? -
Looking at your flow again, I don’t see the “mqtt start” block. Drag that into your flow just below the MQTT connection details and hopefully that fixes it.
-
@world101
Thank you very much, that fixed it!!! Many many thanks. -
Great. Glad I could help.