adafruit / adafruit/Adafruit_CircuitPython_AdafruitIO

use of . and dot and groups (using circuitpython)

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
54
Forks
31
PR merge metrics
No merged PRs in 30d

Description

I posted in one of the adafruit forums, and it was suggested that I submit an issue here.

So, I'm playing with the funhouse, sending feeds for different sensors, and I want to create a group "Test" for my test feeds to go into before deploying it to my Garage, and putting those feeds into the group "Garage"

I created a group Test and a group Garage.

I didn't create any feeds, I was going to let the circuitpython create the feeds as it pushes data.

Then in my circuitpython, I got it to push data to "test.temperature" but what it created was a feed with the name "test.temperature" and the key "test-dot-temperature" :-D

That's not too bad, and kindof understandable, but then it can't continue to push to that feed.

I get the error
```
File "adafruit_portalbase/network.py", line 380, in push_to_io
File "adafruit_io/adafruit_io.py", line 682, in create_new_feed
File "adafruit_io/adafruit_io.py", line 518, in _post
File "adafruit_io/adafruit_io.py", line 498, in _handle_error
AdafruitIO_RequestError: Adafruit IO Error 400: ['Name must be unique within the selected group', 'Key must be unique within the selected group', 'Group feeds is invalid']

```

So it seems there's an inconsistency between the servercode behind
GET feeds/{0} (called from get_feed in adafruit_io/adafruit_io.py
and the server code behind
POST feeds {"name": feed_key ... } (called from create_new_feed in adafruit_io/adafruit_io.py

looks like create_new_feed replaces the . with -dot- but that same replacement isn't done when get_feed is called.

I worked around it by pre-creating my feeds in the group, and then the code behaves as expected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in adafruit_io/adafruit_io.py with get_feed and create_new_feed, then reproduce the CircuitPython push_to_io path described in the report. Compare how dotted feed keys are handled for GET and POST within groups; done means a dotted feed can be created and subsequently found and updated in the same group without pre-creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.