Skip to content

Commit b615e84

Browse files
author
brentru
committed
add methods to subscribe to randomizer service api, throttling feed
1 parent fed0298 commit b615e84

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

adafruit_io/adafruit_io.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@ def subscribe(self, feed_key=None, group_key=None, shared_user=None):
200200
else:
201201
raise AdafruitIO_MQTTError('Must provide a feed_key or group_key.')
202202

203+
def subscribe_throttling(self):
204+
"""Subscribes to the username/throttle feed to
205+
notify you if your Adafruit IO rate limit has been
206+
exceeded.
207+
"""
208+
self._client.subscribe('%s/throttle'%self._user)
209+
210+
def subscribe_randomizer(self, randomizer_id):
211+
"""Subscribes to a random data stream created by the Adafruit IO Words service.
212+
:param int randomizer_id: Random word record you want data for.
213+
"""
214+
self._client.subscribe('{0}/integration/words/{1}'.format(self._user, randomizer_id))
203215

204216
def subscribe_weather(self, integration_id, forecast_type):
205217
"""Subscribes to a weather forecast using the Adafruit IO PLUS weather

0 commit comments

Comments
 (0)