Page 1 of 2

Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 3:53 pm
by greg161
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']

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 4:40 pm
by SpotlightKid
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.

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:04 pm
by greg161
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

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:12 pm
by SpotlightKid
Does

Code: Select all

from umqtt.simple import MQTTClient
work?

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:22 pm
by greg161
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

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:29 pm
by SpotlightKid
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.

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:51 pm
by greg161

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.

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 5:53 pm
by SpotlightKid
Well, do you see it? simple.py is empty (file size = 0).

Re: Nucleo stm32 F429ZI MQTT

Posted: Mon May 11, 2020 6:04 pm
by SpotlightKid
BTW, with

Code: Select all

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

Re: Nucleo stm32 F429ZI MQTT

Posted: Tue May 12, 2020 6:51 pm
by greg161
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 ?