Hello everyone, I am trying to print new messages on my m5 stick c plus, through hive mq. I am able to publish, but not able to subscribe. Not sure what is the issue here, please advise! Thank you in advance!
Here is my code:
from m5stack import *
from m5ui import *
from uiflow import *
import time
setScreenColor(0x111111)
PASSW = None
CLIENTID = None
USER = None
HOST = None
label0 = M5TextBox(47, 49, "label0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(47, 176, "label0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
PASSW = 'password'
CLIENTID = 'm5stack'
USER = 'user'
HOST = '07ecd30c.s1.eu.hivemq.cloud'
from m5mqtt import M5mqtt
m5mqtt = M5mqtt(CLIENTID,HOST,8883,USER,PASSW,300,ssl=True,ssl_params={'server_hostname':HOST})
m5mqtt.start()
label0.setText('Hello M5')
a = None
def callback(topic_data):
a = topic_data
label0.setText(str(a))
pass
while True:
m5mqtt.subscribe(str('topic/1'), callback)
My StickCPlus is currently v1.9.8-plus