Skip to content

Commit a62c68d

Browse files
authored
Merge pull request #43 from adafruit/metadata-and-precision
Added access to metadata and precision arguments
2 parents 6ffe103 + 795871e commit a62c68d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_portalbase/network.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,13 @@ def _get_io_client(self):
362362
self._io_client = IO_HTTP(aio_username, aio_key, self._wifi.requests)
363363
return self._io_client
364364

365-
def push_to_io(self, feed_key, data):
365+
def push_to_io(self, feed_key, data, metadata=None, precision=None):
366366
"""Push data to an adafruit.io feed
367367
368368
:param str feed_key: Name of feed key to push data to.
369369
:param data: data to send to feed
370+
:param dict metadata: Optional metadata associated with the data
371+
:param int precision: Optional amount of precision points to send with floating point data
370372
371373
"""
372374

@@ -385,7 +387,7 @@ def push_to_io(self, feed_key, data):
385387

386388
while True:
387389
try:
388-
io_client.send_data(feed_id["key"], data)
390+
io_client.send_data(feed_id["key"], data, metadata, precision)
389391
except RuntimeError as exception:
390392
print("An error occured, retrying! 2 -", exception)
391393
continue

0 commit comments

Comments
 (0)