Skip to content

Commit f9bc621

Browse files
committed
Update MQTT client to user /data instead of /stream path.
1 parent 3322d93 commit f9bc621

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Adafruit_IO/mqtt_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def _mqtt_disconnect(self, client, userdata, rc):
6969
def _mqtt_message(self, client, userdata, msg):
7070
logger.debug('Client on_message called.')
7171
# Parse out the feed id and call on_message callback.
72-
# Assumes topic looks like "api/feeds/{feed_id}/streams/receive.json"
72+
# Assumes topic looks like "api/feeds/{feed_id}/data/receive.json"
7373
if self.on_message is not None and msg.topic.startswith('api/feeds/') \
74-
and len(msg.topic) >= 31:
75-
feed_id = msg.topic[10:-21]
74+
and len(msg.topic) >= 28:
75+
feed_id = msg.topic[10:-18]
7676
self.on_message(self, feed_id, msg.payload)
7777

7878
def connect(self, **kwargs):
@@ -132,7 +132,7 @@ def subscribe(self, feed_id):
132132
"""Subscribe to changes on the specified feed. When the feed is updated
133133
the on_message function will be called with the feed_id and new value.
134134
"""
135-
self._client.subscribe('api/feeds/{0}/streams/receive.json'.format(feed_id))
135+
self._client.subscribe('api/feeds/{0}/data/receive.json'.format(feed_id))
136136

137137
def publish(self, feed_id, value):
138138
"""Publish a value to a specified feed.
@@ -141,5 +141,5 @@ def publish(self, feed_id, value):
141141
- feed_id: The id of the feed to update.
142142
- value: The new value to publish to the feed.
143143
"""
144-
self._client.publish('api/feeds/{0}/streams/send.json'.format(feed_id),
144+
self._client.publish('api/feeds/{0}/data/send.json'.format(feed_id),
145145
payload=value)

0 commit comments

Comments
 (0)