message callback unknown retain parameter

the message callback does not get any retain parameter. fixing the following trace...

```
Traceback (most recent call last):
  File "./pubsub.py", line 63, in <module>
    client.loop_blocking()
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_IO/mqtt_client.py", line 152, in loop_blocking
    self._client.loop_forever()
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1481, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1003, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1284, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1849, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2305, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2500, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2647, in _handle_on_message
    self.on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_IO/mqtt_client.py", line 108, in _mqtt_message
    self.on_message(self, feed, payload)
TypeError: message() missing 1 required positional argument: 'retain'
```
This commit is contained in:
Eric Keller 2018-07-16 20:31:13 +02:00 committed by GitHub
parent 34a8bc0638
commit 135845a90e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ def disconnected(client):
print('Disconnected from Adafruit IO!') print('Disconnected from Adafruit IO!')
sys.exit(1) sys.exit(1)
def message(client, feed_id, payload, retain): def message(client, feed_id, payload):
# Message function will be called when a subscribed feed has a new value. # Message function will be called when a subscribed feed has a new value.
# The feed_id parameter identifies the feed, and the payload parameter has # The feed_id parameter identifies the feed, and the payload parameter has
# the new value. # the new value.