Getting Started: Raspberry Pi Pico W

Hi - I am trying to use the HiveMQ Cloud to start getting familiar with MQTT using a Raspberry Pico W as the client device. I was using your recent blog about using Raspberry Pi Pico / Airlift WiFi as a reference although I am using microPython instead of circuitPython.

I can use the HiveMQ public broker service without any issues but when I try to connect to the HiveMQ cloud I get the error message “MQTT connect failed: extra keyword arguments given” which seems to be related to the ssl_params

Snippet of code:-
from umqtt.simple2 import MQTTClient

mqtt_client = MQTTClient(
client_id=secrets[‘mqtt_clientid’],
server=secrets[“mqtt_server”],
port=secrets[“mqtt_port”],
user=secrets[“mqtt_username”],
password=secrets[“mqtt_key”],
ssl=True,
ssl_params={‘keyfile’:‘/server.key’,‘certfile’:‘/server.pem’}

)
mqtt_client.connect()

Any help would be appreciated :slight_smile:

Hello @IanW6374 ,

It is nice to see your interest in MQTT and HiveMQ, please welcome to our community!

The error extra keyword arguments given refers to a method from your SSL library. Can you see the error in the traceback, something like this?

Traceback (most recent call last):                                                                                       
TypeError: extra keyword arguments given 

Did you try running your code without specifying ssl_params? The issue is that SSL parameters that the library supports might differ between implementations:

Depending on the underlying module implementation in a particular MicroPython port, some or all keyword arguments above may be not supported.
[Reference: ssl – SSL/TLS module — MicroPython 1.19.1 documentation]

I hope this helps,
Dasha from HiveMQ team