# How to receive MQTT data using Subscribe and callback

**URL:** https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596
**Category:** Hardware
**Tags:** python
**Created:** [20 March 2024 16:10 UTC](https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596 "2024-03-20T16:10:24Z")
**Posts on this page:** 3
**Page:** 2

<div class="post-metadata">

### Author: ![badflash](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@badflash](https://discourse.nodered.org/u/badflash)
#### Post date: [22 March 2024 13:09 UTC](https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596/21 "2024-03-22T13:09:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [22 March 2024 13:48 UTC](https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596/22 "2024-03-22T13:48:48Z")

</div>

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...

```auto
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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [20 June 2024 13:49 UTC](https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596/23 "2024-06-20T13:49:11Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/how-to-receive-mqtt-data-using-subscribe-and-callback/86596.md?page=1)
