Skip to content

Commit 2076935

Browse files
authored
Merge pull request #120 from adafruit/tyeth/issue119
Highlight usage of different methods for group feeds + cleanup multigroup feeds
2 parents c9ad360 + a049b6f commit 2076935

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

examples/adafruit_io_http/adafruit_io_groups.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,24 @@
6363
print("Creating a new Adafruit IO Group...")
6464
sensor_group = io.create_new_group("envsensors", "a group of environmental sensors")
6565

66-
# Add the 'temperature' feed to the group
67-
print("Adding feed temperature to group...")
68-
io.add_feed_to_group(sensor_group["key"], "temperature")
66+
# Create the 'temperature' feed in the group
67+
print("Creating feed temperature inside group...")
68+
io.create_feed_in_group(sensor_group["key"], "temperature")
69+
70+
# Create the 'humidity' feed then add to group (it will still be in Default group too)
71+
print("Creating feed humidity then adding to group...")
72+
humidity_feed = io.create_new_feed("humidity", "a feed for humidity data")
73+
io.add_feed_to_group(sensor_group["key"], humidity_feed["key"])
6974

7075
# Get info from the group
76+
print("Getting fresh group info...")
77+
sensor_group = io.get_group("envsensors") # refresh data via HTTP API
7178
print(sensor_group)
7279

7380
# Delete the group
7481
print("Deleting group...")
7582
io.delete_group("envsensors")
83+
84+
# Delete the remaining humidity feed (it was in Two Groups so not deleted with our group)
85+
print("Deleting feed humidity (still in default group)...")
86+
io.delete_feed(humidity_feed["key"])

0 commit comments

Comments
 (0)