adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

Highlight usage of different methods for group feeds + cleanup multigroup feeds #120

Closed tyeth closed 2 months ago

tyeth commented 2 months ago

User feedback (support issue) was:

Running a bit of the sample code from https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/blob/main/examples/adafruit_io_http/adafruit_io_groups.py I get this error: Adafruit IO Error 404: not found - API documentation can be found athttps://io.adafruit.com/api/docs It seems that the API call add_feed_to_group(..) is not working

It appears the code has changed since the example was written and there is a newer "create_feed_in_group" method. It's also the case that the add_feed_to_group method always required an existing feed (at least according to the comments in code).

I've expanded the example to:

  1. instead first create a feed in a group
  2. then use the add a feed to a group method (with a newly created feed)
  3. then after deleting the group only one of the feeds will be automatically removed (the one created in the group), as it has no references left to groups. Whereas the humidity one was created in the Default group and simply gained association to a second group.
  4. remove the humidity feed as a final step.

Fixes #119

wavesailor commented 2 months ago

That's fixes one of the issues.

But I still get an error when I try add an existing feed to the sensors group using add_feed_to_group(group_key: str, feed_key: str) link to API Doc

The API has the error or the error is in code of the library file adafruit_io.py