0

Getting an error uploading to Adafruit IO
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Getting an error uploading to Adafruit IO

by kflmiami420 on Sat Aug 24, 2019 2:31 am

Code: Select all | TOGGLE FULL SIZE
Temp=29.8*C Humidity=37.2%
Temp=29.8*C Humidity=37.2%
Temp=29.8*C Humidity=37.2%
Temp=29.8*C Humidity=37.4%
Temp=29.7*C Humidity=37.2%
Temp=29.6*C Humidity=37.1%
Temp=29.5*C Humidity=36.5%
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 344, in _make_request
    self._validate_conn(conn)
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 843, in _validate_conn
    conn.connect()
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 316, in connect
    conn = self._new_conn()
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0xb5cfbd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/.local/lib/python3.5/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/kflmiami420/feeds/temperature/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5cfbd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "temp_humidity.py", line 35, in <module>
    aio.send(temperature_feed.key, str(temperature))
  File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 154, in send_data
    return self.create_data(feed, payload)
  File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 254, in create_data
    return Data.from_dict(self._post(path, data._asdict()))
  File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 126, in _post
    data=json.dumps(data))
  File "/home/pi/.local/lib/python3.5/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/kflmiami420/feeds/temperature/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5cfbd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
pi@raspberrypize11:~ $



Can some one help me out

Raspberry Pi Zero w - DHT22 sensor and bme280 sensor . Debian Buster

this is the python code for my setup

Code: Select all | TOGGLE FULL SIZE
#emdht22.py'

import time
import Adafruit_DHT
from Adafruit_IO import Client, Feed

DHT_READ_TIMEOUT = 35
DHT_DATA_PIN = 10

ADAFRUIT_IO_KEY = '0d23xxxxxxxxxxxxxxxxxxxxxxxxx'
ADAFRUIT_IO_USERNAME = 'miamihurricaneschain'

aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

temperature_feed = aio.feeds('temperature')
humidity_feed = aio.feeds('humidity')

dht22_sensor = Adafruit_DHT.DHT22

while True:
    humidity, temperature = Adafruit_DHT.read_retry(dht22_sensor, DHT_DATA_PIN)
    if humidity is not None and temperature is not None:
        print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity))
        # Send humidity and temperature feeds to Adafruit IO
        temperature = '%.2f'%(temperature)
        humidity = '%.2f'%(humidity)
        aio.send(temperature_feed.key, str(temperature))
        aio.send(humidity_feed.key, str(humidity))
    else:
        print('Failed to get DHT22 Reading, trying again in ', DHT_READ_TIMEOUT, 'seconds$
    time.sleep(DHT_READ_TIMEOUT)

kflmiami420
 
Posts: 126
Joined: Tue Aug 21, 2018 9:43 pm

Re: Getting an error uploading to Adafruit IO

by be80be on Sat Aug 24, 2019 10:40 am

Your losing internet connection

be80be
 
Posts: 15
Joined: Sat Jun 13, 2015 12:05 am

Please be positive and constructive with your questions and comments.