0

AdafruitIO_Feed get method fails silently for case mismatch
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

AdafruitIO_Feed get method fails silently for case mismatch

by orcrist on Sun Nov 25, 2018 8:48 pm

Hi ,

I'm not sure the best place to report this.
I noticed a small problem with either the AdafruitIO_Feed "get" method or how the io.adafruit service handles it.

I was playing around with the "adafruitio_14_neopixel" script, and when I created my "color" feed, I capitalized "Color" without really thinking about it. While troubleshooting another problem I thought maybe my script needs to instantiate the "AdafruitIO_Feed" with the correct case, so I modifed that line to:
Code: Select all | TOGGLE FULL SIZE
AdafruitIO_Feed *color = io.feed("Color");


After fixing some other stuff, I had the script working, except that it would not get the last stated when initializing. I dug around and found that older references saying you need to run e.g. "color->get();" to force that. "Eureka", I thought, until I saw that "get" is already in the example I was using.

After a bunch of debug messages and trial and error, I found that changing my "Color" back to "color" fixed the get method not doing anything. I still can't figure out where the mismatch is causing problems, and it's really tricky because every other method, including the event handling, seems to work fine even with "Color".

It's worth noting that the io.adafruit web interface shows "Color" under the list of feeds, but "color" under the Key column, so obviously the original name is canonicalized to lower case. It's just not working for that get method.

orcrist
 
Posts: 11
Joined: Wed Jan 11, 2017 1:13 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by brubell on Wed Nov 28, 2018 11:22 am

Feeds display in Adafruit IO as upper-case but the instanciators (like AdafruitIO_Feed) take in the feed key, not the feed name.
Attachments
IO_-_Feeds.png
removing incorrect get() info
IO_-_Feeds.png (8.43 KiB) Viewed 85 times

brubell
 
Posts: 189
Joined: Fri Jul 17, 2015 10:33 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by orcrist on Wed Nov 28, 2018 3:06 pm

"get" is deprecated?
I updated my libraries 2 days ago, and it's still shown in all the examples. There are no documents even hinting it will be deprecated.

How are we supposed to do that initialization to get the last value then? Is it documented somewhere?

orcrist
 
Posts: 11
Joined: Wed Jan 11, 2017 1:13 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by orcrist on Fri Nov 30, 2018 5:31 pm

Bump.
Any answer to the proper way to initialize the program with the last submitted value if get() is deprecated?
If get is deprecated there must be a new way to do it, right?

orcrist
 
Posts: 11
Joined: Wed Jan 11, 2017 1:13 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by orcrist on Tue Dec 04, 2018 1:12 pm

Can someone please answer this question?
What is the replacement for the get() method if it's deprecated?

orcrist
 
Posts: 11
Joined: Wed Jan 11, 2017 1:13 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by brubell on Wed Dec 05, 2018 11:16 am

orcrist wrote:Can someone please answer this question?
What is the replacement for the get() method if it's deprecated?


I was incorrect in stating the {username}/feeds/{key}/get MQTT topic was depreciated, it has not been.

The issue might be that you're using a name to identify the feed in code, while you should be using the key itself.

brubell
 
Posts: 189
Joined: Fri Jul 17, 2015 10:33 pm

Re: AdafruitIO_Feed get method fails silently for case misma

by orcrist on Wed Dec 05, 2018 11:20 am

Ah, good to know, thank you.

And yes, that was the issue I was reporting. I just thought it was worth reporting that only the Get method was affected (everything else in the library worked), and that it failed silently. There was no error/exception thrown; rather the Get method just didn't perform the update.

orcrist
 
Posts: 11
Joined: Wed Jan 11, 2017 1:13 pm

Please be positive and constructive with your questions and comments.