Core2 MQTT fails to subscribe on SSL=True
-
Hello everyone
I have trouble with connecting my Core2 to HiveMQ using MQTT.
What works well so far:
- Connecting to a public MQTT broker (hivemq or mosquitto) with no auth (and no SSL) works perfectly fine.
- Connecting to my private cloud broker works and I can send messages (from core2 to hivemq) when using the 'execute code' block.
What does not work and drives me kind of crazy is that I don't receive any messages on the topics I subscribed to -- when being connected to the private cloud instance using SSL.
Any hints on what is wrong are greatly appreciated :)
Cheers, Alex
-
Well, according to that image, you are missing the SSL codes, keys and certificates.
-
Hello @alexanders
it looks like the generated micropython code is missing the statement to actually subscribe. I have to add something like below, in an
Execute Code
block, just before themqtt start
block to make the subscription work:m5mqtt.subscribe(str('kesabi'), fun_kesabi_)
Thanks
Felix -
Hello @ajb2k3
afaik, the client
keyFile
andcertFile
are optional and only required if the MQTT broker is setup to verify the MQTT client. Or am I missing something?Thanks
Felix -
@felmue
If you check out the Execute Code block the params are different.
For some reason there is an oddity with security lately that if SSL is set to true in MicroPython the the files are required.Also the main program functions need to be run in a loop placed after the MQTT Start block.
-
-
@felmue said in Core2 MQTT fails to subscribe on SSL=True:
Hello @ajb2k3
ah, ok, thank you for the information. I was not aware of that.
Thanks
FelixNo worries, it's not a well know feature.
-
-
@alexanders thanks to you question, I have now added a paragraph about this to my book which will hopefully get an update by the end of the month!