Skip to content

Commit

Permalink
Merge pull request #120 from adafruit/tyeth/issue119
Browse files Browse the repository at this point in the history
Highlight usage of different methods for group feeds + cleanup multigroup feeds
  • Loading branch information
brentru authored Jun 25, 2024
2 parents c9ad360 + a049b6f commit 2076935
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions examples/adafruit_io_http/adafruit_io_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,24 @@
print("Creating a new Adafruit IO Group...")
sensor_group = io.create_new_group("envsensors", "a group of environmental sensors")

# Add the 'temperature' feed to the group
print("Adding feed temperature to group...")
io.add_feed_to_group(sensor_group["key"], "temperature")
# Create the 'temperature' feed in the group
print("Creating feed temperature inside group...")
io.create_feed_in_group(sensor_group["key"], "temperature")

# Create the 'humidity' feed then add to group (it will still be in Default group too)
print("Creating feed humidity then adding to group...")
humidity_feed = io.create_new_feed("humidity", "a feed for humidity data")
io.add_feed_to_group(sensor_group["key"], humidity_feed["key"])

# Get info from the group
print("Getting fresh group info...")
sensor_group = io.get_group("envsensors") # refresh data via HTTP API
print(sensor_group)

# Delete the group
print("Deleting group...")
io.delete_group("envsensors")

# Delete the remaining humidity feed (it was in Two Groups so not deleted with our group)
print("Deleting feed humidity (still in default group)...")
io.delete_feed(humidity_feed["key"])

0 comments on commit 2076935

Please sign in to comment.