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

MicroPython • Re: Pico 2 mqtt quick question on sending binary

$
0
0
Posted the wrong link. client connect looks like this

Code:

def connect_mqtt():    try:        client = MQTTClient(client_id=MQTT_CLIENT_ID,                            server=MQTT_SERVER,                            port=MQTT_PORT,                            user=MQTT_USER,                            password=MQTT_PASSWORD,                            keepalive=MQTT_KEEPALIVE,                            ssl=MQTT_SSL,                            ssl_params=MQTT_SSL_PARAMS)        client.connect()
The ideal solution would seem to be to put 'secrets.' before the names of the variables defined within 'secrets.py' -

Code:

        client = MQTTClient(client_id=secrets.MQTT_CLIENT_ID,                            server=secrets.MQTT_SERVER,                            port=secrets.MQTT_PORT,                            user=secrets.MQTT_USER,                            password=secrets.MQTT_PASSWORD,                            keepalive=secrets.MQTT_KEEPALIVE,                            ssl=secrets.MQTT_SSL,                            ssl_params=secrets.MQTT_SSL_PARAMS)

Statistics: Posted by hippy — Mon Feb 10, 2025 10:58 am



Viewing all articles
Browse latest Browse all 7512

Trending Articles