Skip to content

IO_MQTT.unsubscribe doesn't unsubscribe group-key? (adafruit_io.py) #87

Closed
@awgrover

Description

@awgrover

In main, and 5.0.4, IO_MQTT.subscribe(feed_key=None,group_key="something") does self._client.subscribe("{0}/groups/{1}".format(self._user, group_key)). Note the group_key. But .unsubscribe() uses feed_key.

That seems like a bug. Wouldn't that fail to unsubscribe from the group?

Suggested patch for unsubscribe (vs 5.0.4, but almost identical fix for main).

--- adafruit_io.py      2022-03-29 10:03:10.891820967 -0400
+++ adafruit_io.py.fix  2022-04-08 11:15:09.378827819 -0400
@@ -334,7 +334,7 @@
         if shared_user is not None and feed_key is not None:
             self._client.unsubscribe("{0}/feeds/{1}".format(shared_user, feed_key))
         elif group_key is not None:
-            self._client.unsubscribe("{0}/groups/{1}".format(self._user, feed_key))
+            self._client.unsubscribe("{0}/groups/{1}".format(self._user, group_key))
         elif feed_key is not None:
             self._client.unsubscribe("{0}/feeds/{1}".format(self._user, feed_key))
         else:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions