This is message that I get:
Traceback (most recent call last):
File "/home/pi/Python_3/WeatherPi-io-tk.py", line 36, in <module>
direction_feed = aio.feeds('wind_direction')
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 274, in feeds
return Feed.from_dict(self._get(path))
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 118, in _get
self._handle_error(response)
File "/home/pi/.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 - that is an invalid URL, please check the API documentation at https://io.adafruit.com/api/docs to make sure your URL is correct
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/Python_3/WeatherPi-io-tk.py", line 41, in <module>
temperature_feed = aio.create_feed(Feed(name='temperature'))
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 281, in create_feed
return Feed.from_dict(self._post(path, {"feed": feed._asdict()}))
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 127, in _post
self._handle_error(response)
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 105, in _handle_error
raise RequestError(response)
Adafruit_IO.errors.RequestError: Adafruit IO request failed: 400 Bad Request - ['Name must be unique within the selected group', 'Name must not match an existing key within the selected group', 'Key must be unique within the selected group', 'Group feeds is invalid']
>>>.
Here is the Code I used
- Code: Select all | TOGGLE FULL SIZE
from Adafruit_IO import Client, Feed, RequestError
ADAFRUIT_IO_USERNAME = '???'
ADAFRUIT_IO_KEY = '???'
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
#set up feed
try: # if we already have the feeds, assign them.
temperature_feed = aio.feeds('temperature')
humidity_feed = aio.feeds('humidity')
pressure_feed = aio.feeds('pascals')
rain_feed = aio.feeds('rain')
wind_feed = aio.feeds('wind')
direction_feed = aio.feeds('wind_direction')
power_feed = aio.feeds('power')
except RequestError: # if we don't, create and assign them.
temperature_feed = aio.create_feed(Feed(name='temperature'))
humidity_feed = aio.create_feed(Feed(name='humidity'))
pressure_feed = aio.create_feed(Feed(name='pascals'))
rain_feed = aio.create_feed(Feed(name='rain'))
wind_feed = aio.create_feed(Feed(name='wind'))
direction_feed = aio.create_feed(Feed(name='wind_direction'))
power_feed = aio.create_feed(Feed(name='power'))
"""
====================================================================
IN MAIN
"""
if IO_count == 10:
# Send to feed
aio.send(temperature_feed.key, Temp)
aio.send(humidity_feed.key, int(humidity))
aio.send(pressure_feed.key, int(hectopascals))
aio.send(rain_feed.key, wet)
aio.send(wind_feed.key,windspeed)
aio.send(direction_feed.key,values)
aio.send(power_feed.key,amps)
IO_count = 0
else:
IO_count = IO_count +1