Skip to content

Commit

Permalink
PR Feedback: label client v1, clarify paho client in example/viewall
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Feb 16, 2024
1 parent a0cb9f6 commit 2737781
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions Adafruit_IO/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
import json, requests
from paho.mqtt.client import error_string

# MQTT RC Error Types *** OBSOLETE ***
# See error_string() in client.py and enums.py from paho instead
# https://github.com/eclipse/paho.mqtt.python/blob/4eeb431f5ae72b42474cec42641fca1daa91c4b0/src/paho/mqtt/client.py#L291-L404
MQTT_ERRORS = [ 'Connection successful',
'Incorrect protocol version',
'Invalid Client ID',
'Server unavailable ',
'Bad username or password',
'Not authorized' ]

class AdafruitIOError(Exception):
"""Base class for all Adafruit IO request failures."""
pass
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_IO/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, username, key, service_host='io.adafruit.com', secure=True):
self.on_disconnect = None
self.on_message = None
self.on_subscribe = None
# Initialize MQTT client.
# Initialize v1 MQTT client.
self._client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
if secure:
self._client.tls_set_context()
Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt/mqtt_viewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def on_message(client, userdata, msg):
print('Received on {0}: {1}'.format(msg.topic, msg.payload.decode('utf-8')))


# Create MQTT client and connect to Adafruit IO.
# Create Paho v1 MQTT client and connect to Adafruit IO.
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
client.username_pw_set(USERNAME, KEY)
client.on_connect = on_connect
Expand Down

0 comments on commit 2737781

Please sign in to comment.