Nucleo stm32 F429ZI MQTT

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
greg161
Posts: 10
Joined: Wed May 06, 2020 1:54 pm

Nucleo stm32 F429ZI MQTT

Post by greg161 » Mon May 11, 2020 3:53 pm

I try to use MQTT on this board, I saved simple.py and robust.py on board , but I have an error:

Code: Select all

>>> from umqtt.robust import MQTTClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'umqtt'
my files:

Code: Select all

>>> os.listdir('lib')
['robust.py', 'simple.py']

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Nucleo stm32 F429ZI MQTT

Post by SpotlightKid » Mon May 11, 2020 4:40 pm

You need to put those files in a directory called 'umqtt' located in the same dir as your main.py, i.e. the root of your flash file system.

greg161
Posts: 10
Joined: Wed May 06, 2020 1:54 pm

Re: Nucleo stm32 F429ZI MQTT

Post by greg161 » Mon May 11, 2020 5:04 pm

Some progress :

Code: Select all

>>> os.listdir()
['boot.py', 'main.py', 'pybcdc.inf', 'README.txt', 'umqtt', 'lib']
>>> os.listdir('umqtt')
['robust.py', 'simple.py']
>>> from umqtt.robust import MQTTClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: can't import name MQTTClient

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Nucleo stm32 F429ZI MQTT

Post by SpotlightKid » Mon May 11, 2020 5:12 pm

Does

Code: Select all

from umqtt.simple import MQTTClient
work?

greg161
Posts: 10
Joined: Wed May 06, 2020 1:54 pm

Re: Nucleo stm32 F429ZI MQTT

Post by greg161 » Mon May 11, 2020 5:22 pm

Unfortunally not:

Code: Select all

>>> from umqtt.simple import MQTTClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: can't import name MQTTClient

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Nucleo stm32 F429ZI MQTT

Post by SpotlightKid » Mon May 11, 2020 5:29 pm

Are you sure simple.py and robust.py have been transferred correctly? Maybe they are empty? Try

Code: Select all

>>> import uos
>>> print(list(uos.ilistdir('umqtt')))
[('robust.py', 32768, 0, 1045), ('simple.py', 32768, 0, 6411)]
The last number in each tuple is the file size.

greg161
Posts: 10
Joined: Wed May 06, 2020 1:54 pm

Re: Nucleo stm32 F429ZI MQTT

Post by greg161 » Mon May 11, 2020 5:51 pm

Code: Select all

>>> import uos
>>> print(list(uos.ilistdir('umqtt')))
[('robust.py', 32768, 0, 1038), ('simple.py', 32768, 0, 0)]
Yes, it was the problem, I sent again the file to the board and put it to umqtt directory and it works. Beginning is very hard.
Last edited by greg161 on Mon May 11, 2020 6:01 pm, edited 1 time in total.

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Nucleo stm32 F429ZI MQTT

Post by SpotlightKid » Mon May 11, 2020 5:53 pm

Well, do you see it? simple.py is empty (file size = 0).

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Nucleo stm32 F429ZI MQTT

Post by SpotlightKid » Mon May 11, 2020 6:04 pm

BTW, with

Code: Select all

rshell cat /pyboard/<file>
You can check the contents of files on the board.

greg161
Posts: 10
Joined: Wed May 06, 2020 1:54 pm

Re: Nucleo stm32 F429ZI MQTT

Post by greg161 » Tue May 12, 2020 6:51 pm

MQTT works like a charm :), thanks a lot.
Is there any option to use rshell remote like telnet ?
I see that there is telnet server for ESP32 but it is prepared for WiFi , is it possible to use it on LAN network ?

Post Reply