From c3cdd7b349b154f7cfaf31fe20153d70b8374b35 Mon Sep 17 00:00:00 2001 From: brentru Date: Tue, 12 Feb 2019 17:45:11 -0500 Subject: [PATCH] add mqtt get to client, bump version --- Adafruit_IO/_version.py | 2 +- Adafruit_IO/mqtt_client.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Adafruit_IO/_version.py b/Adafruit_IO/_version.py index 259fe5f..b842790 100644 --- a/Adafruit_IO/_version.py +++ b/Adafruit_IO/_version.py @@ -1 +1 @@ -__version__ = "2.1" \ No newline at end of file +__version__ = "2.1.1" \ No newline at end of file diff --git a/Adafruit_IO/mqtt_client.py b/Adafruit_IO/mqtt_client.py index 22cda92..8272ff1 100644 --- a/Adafruit_IO/mqtt_client.py +++ b/Adafruit_IO/mqtt_client.py @@ -256,6 +256,15 @@ def unsubscribe(self, feed_id=None, group_id=None): raise TypeError('Invalid topic type specified.') return + def receive(self, feed_id): + """Receive the last published value from a specified feed. + + :param string feed_id: The ID of the feed to update. + :parm string value: The new value to publish to the feed + """ + (res, self._pub_mid) = self._client.publish('{0}/feeds/{1}/get'.format(self._username, feed_id), + payload='') + def publish(self, feed_id, value=None, group_id=None, feed_user=None): """Publish a value to a specified feed.