Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5273

MicroPython • Re: Pico W - MQTT

$
0
0
Ok is it working now?
Obviously I can't speak for the OP but I ran into exactly the same issue ...

I had my MQTT working on my Pico W with an 'mqtt.simple.py' which had been forked from MicroPython-Lib and was provided by the tutorial I followed. That worked fine and had 'ssl_params' as a keyword parameter.

Upgrading to the official and latest MicroPython-Lib version of 'mqtt.simple.py' I immediately hit the same error, 'unexpected keyword ssl_params'.

Your link to the GitHub issue solved that for me, so I guess should have for the OP.

So thanks from me at least.

Code:

MQTT_BROKER     = "broker.hivemq.com"MQTT_PORT       = 1883MQTT_USER       = None# You can connect without a username, without even registeringMQTT_PASSWORD   = None# But nothing is privateMQTT_CLIENT_ID  = "picow"MQTT_KEEPALIVE  = 7200MQTT_SSL        = NoneMQTT_TOPIC      = "testing"if True:  # Switch to using secure SSL  import ssl  context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)  context.verify_mode = ssl.CERT_NONE  MQTT_PORT     = 8883  MQTT_SSL      = contextfrom mqtt.simple import MQTTClientclient = MQTTClient(client_id  = MQTT_CLIENT_ID,                    server     = MQTT_BROKER,                    port       = MQTT_PORT,                    user       = MQTT_USER,                    password   = MQTT_PASSWORD,                    keepalive  = MQTT_KEEPALIVE,                    ssl        = MQTT_SSL)client.connect()
The official 'mqtt.simple.py' and 'mqtt.robust.py' files will commonly be found at -

~/pico/micropython-lib/micropython/umqtt.simple/umqtt/simple.py
~/pico/micropython-lib/micropython/umqtt.robust/umqtt/robust.py

Statistics: Posted by hippy — Tue Jul 23, 2024 1:03 pm



Viewing all articles
Browse latest Browse all 5273

Trending Articles