How to receive MQTT data using Subscribe and callback

I see the ping didn't work. I tried the Upload button but it didn't seem to embed it right. I don't see way to upload a picture other than that.

Just found a RPi Pico-W and loaded the script I posted above onto it - it worked fine, no errors.
Only thing I had to do was install 'umqttsimple.py' in the /lib directory and change the import on line-3 to...

from umqttsimple import MQTTClient

The RPi-Pico-W I found was flashed with v1.19.1 (2022-08-18) which is rather old as the latest version is v1.22.2 (2024-02-22) (which might have umqtt.simple or umqttsimple already built-in).

EDIT:
Just installed Micro-Python v1.23.0 (2024-03-22) on a RPi-Pico-W and can confirm there is no umqtt or umqtt.simple modules built-in. My script runs fine (with the above install of umqttsimple.py) with no errors.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.