adafruit / adafruit/Adafruit_IO_Arduino
Group data is never cleared
- Dominant language
- C++
- Stars
- 222
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
I have some code like this where I have a single AdafruitIO_Group object that I use to interact with a feed group.
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
AdafruitIO_Group *grp = io.group("mygroup");
void setup() {
grp->onMessage(handleMessage);
grp->set("FOREVER", "never-comes");
grp->save();
}
void loop() {
if (something_happened) {
grp->set("Temperature", get_temp());
grp->save();
}
}
void handleMessage(AdafruitIO_Data *data) { }
Every time I call grp->save(), I find that the AdafruitIO_Data object has all the different feeds in it that it has ever touched, and they all get sent to IO again. It seems like it also has the data received and sent to handleMessage(). Sometimes the data is duplicated, like this:
FOREVER = never-comes
Temperature = 72
forever = never-comes
temperature = 71
One problem is that I don't want to publish every value that I've already sent before when I save. Another is that there are duplicated feeds here. It's not clear to me what will be "saved" when I publish a feed with both "Temperature=72" and (keyname) "temperature=71" in the data collection.
It's important to me that I don't Publish old values that might now be stale. This scenario would create a race between my Published updates and the dashboard updates I could receive, but it doesn't give me any clear option to avoid this race.
I can work around this by creating a new Group object every time I want to publish, but it wasn't clear to me that this was required from the docs, and this behavior is unexpected.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the AdafruitIO_Group object through grp->set(), grp->save(), and the onMessage callback described in the report. Reproduce repeated saves with the FOREVER and Temperature feeds, including differing capitalization, and verify that old or received values are not republished and that duplicate feed names have defined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100