Skip to content

Commit

Permalink
Update error codes + shared_feeds example
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Feb 14, 2024
1 parent 29bed98 commit a0cb9f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Adafruit_IO/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
# SOFTWARE.

import json, requests
from paho.mqtt.client import error_string

# MQTT RC Error Types
# 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',
Expand Down Expand Up @@ -63,6 +66,6 @@ class MQTTError(Exception):
"""Handles connection attempt failed errors.
"""
def __init__(self, response):
error = MQTT_ERRORS[response]
error = error_string(response)
super(MQTTError, self).__init__(error)
pass
2 changes: 1 addition & 1 deletion examples/mqtt/mqtt_shared_feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ def message(client, feed_id, payload):
while True:
value = random.randint(0, 100)
print('Publishing {0} to {1}.'.format(value, IO_FEED))
client.publish(IO_FEED, value, IO_FEED_USERNAME)
client.publish(IO_FEED, value, feed_user=IO_FEED_USERNAME)
time.sleep(10)

0 comments on commit a0cb9f6

Please sign in to comment.