Closed octubot closed 5 years ago
@octubot How did you install this (pip or via setup)?
Do you see a digital
feed listed on your Adafruit IO Feed page?
-> https://io.adafruit.com/feeds
@octubot How did you install this (pip or via setup)?
Do you see a
digital
feed listed on your Adafruit IO Feed page? -> https://io.adafruit.com/feeds
yes I do see the feed
@octubot Could you attempt to make the client list your feeds by adding the following to your code?
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
feeds = aio.feeds()
print(feeds)
@octubot Could you attempt to make the client list your feeds by adding the following to your code?
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY) feeds = aio.feeds() print(feeds)
i added this to my code and this was the results
[Feed(name='Welcome Feed', key='welcome-feed', description=None, unit_type=None, unit_symbol=None, history=True, visibility='private', license=None, status_notify=False, status_timeout=4320), Feed(name='openiotdoor', key='openiotdoor', description=None, unit_type=None, unit_symbol=None, history=True, visibility='private', license=None, status_notify=False, status_timeout=4320), Feed(name='doors', key='doors', description=None, unit_type=None, unit_symbol=None, history=True, visibility='private', license=None, status_notify=False, status_timeout=4320), Feed(name='iotdoor', key='iotdoor', description=None, unit_type=None, unit_symbol=None, history=True, visibility='private', license=None, status_notify=False, status_timeout=4320), Feed(name='digital', key='digital', description=None, unit_type=None, unit_symbol=None, history=True, visibility='private', license=None, status_notify=False, status_timeout=4320)]
Traceback (most recent call last):
File "/Users/zeyad/PycharmProjects/untitled/dwsd.py", line 42, in
@octubot I was able to reproduce this on my end, it seems like the create_feed
method isn't working.
I'll look into it, renaming the issue's topic to reflect the bug.
4 test_feed = Feed(name='doesntexist')
----> 5 test_feed = aio.create_feed(test)
the code creates the feeds but if crashes idk why.
i tried this code to test the connection
Example of turning on and off a LED from the Adafruit IO Python Client
Author(s): Brent Rubell, Todd Treece """
import time
from Adafruit_IO import Client, Feed, RequestError
ADAFRUIT_IO_KEY = 'XXXXXX'
ADAFRUIT_IO_USERNAME = 'xxxxxx'
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
'''try: # if we have a 'digital' feed
digital = aio.feeds('digital')
feeds = aio.feeds()
print(feeds)
except RequestError: # create a digital feed feed = Feed(name="digital") digital = aio.create_feed(feed)'''
digital = aio.feeds('digital')
while True: data = aio.receive(digital) if int(data.value) == 1: print('received <- ON\n')
elif int(data.value) == 0:
print('received <- OFF\n')
#GPIO.output("P8_8", GPIO.LOW)
# timeout so we dont flood adafruit-io with requests
time.sleep(0.5)
the results were
Traceback (most recent call last):
File "/Users/zeyad/PycharmProjects/untitled/dwsd.py", line 43, in
I tested this morning with the latest version of Adafruit IO Python installed directly from this repository and was unable to reproduce the 404 error. I ran the code against a feed which exists, and a feed which doesn't exist, and was able to write to both (in the instance of the feed which did not exist, it was created as expected).
Please make sure you're using the latest version of Adafruit IO Python with a valid active key and username
hello everybody, I am trying to use adafruit digital output example. I did everything as it was explained. However, I did modify the code so it could in my BBB.
this is the code i used. :
""" 'digital_out.py'
Example of turning on and off a LED from the Adafruit IO Python Client
Author(s): Brent Rubell, Todd Treece """
Import standard python modules
import time
import Adafruit_BBIO.GPIO as GPIO
import Adafruit IO REST client.
from Adafruit_IO import Client, Feed, RequestError
Set to your Adafruit IO key.
Remember, your key is a secret,
so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'XXXXXXXXXXXX'
Set to your Adafruit IO username.
(go to https://accounts.adafruit.com to find your username)
ADAFRUIT_IO_USERNAME = 'XXXXXXXXXX'
Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
GPIO.setup("GPIO0_20", GPIO.OUT)
try: # if we have a 'digital' feed digital = aio.feeds('digital') except RequestError: # create a digital feed feed = Feed(name="digital") digital = aio.create_feed(feed)
led set up
while True: data = aio.receive(digital.key) if int(data.value) == 1: GPIO.output("GPIO0_20", GPIO.HIGH) print('received <- ON\n')
However, I keep getting this error:
Traceback (most recent call last): File "aio1.py", line 38, in
data = aio.receive(digital.key)
File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 216, in receive
return Data.from_dict(self._get(path))
File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 118, in _get
self._handle_error(response)
File "/home/debian/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 108, in _handle_error
raise RequestError(response)
Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found - API documentation can be found at https://io.adafruit.com/api/docs
please advise.
thank you.