🎁📬❄️📦Adafruit Holiday Shipping Deadlines 2019: Please place all UPS 2 Day orders by 11am Monday, December 16 📦❄️📬🎁
0

I am getting errors on my Pi Zero W
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.

I am getting errors on my Pi Zero W

by kflmiami420 on Thu Oct 24, 2019 3:30 pm

This is just for a DHT22 that sends Temp and Humidity to the IO

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 0xb5d59990>: 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 0xb5d59990>: 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 "1-dht22io.py", line 31, in <module>
aio.send(temperature_feed.key, '{0:.2f} F'.format(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 0xb5d59990>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

And this is for a bme280 sensor is also wired to the same Pi Zero W

Temperature: 89.6 F
Humidity: 37.0 %
Pressure: 1016.1 hPa
Altitude = 7.43 meters
Reading BME280 Sensor...
Sending BME280 data to adafruit io...
Temperature: 89.6 F
Humidity: 37.0 %
Pressure: 1016.1 hPa
Altitude = 7.80 meters
Reading BME280 Sensor...
Sending BME280 data to adafruit io...
Temperature: 89.6 F
Humidity: 37.0 %
Pressure: 1016.1 hPa
Altitude = 7.49 meters
Reading BME280 Sensor...
Sending BME280 data to adafruit io...
Temperature: 89.6 F
Humidity: 36.0 %
Pressure: 1016.1 hPa
Altitude = 7.93 meters
Reading BME280 Sensor...
Sending BME280 data to adafruit io...
Temperature: 89.6 F
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 0xb5bf9590>: 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/temperature2/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5bf9590>: 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 "3-bme280io.py", line 54, in <module>
aio.send(temperature_feed.key, '{0:.2f} F'.format(temperature_data))
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/temperature2/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5bf9590>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

I clear the terminal
and re start the python3 script and come back later during the day and its has given me these errors.

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

Re: I am getting errors on my Pi Zero W

by brubell on Tue Oct 29, 2019 10:50 am

Hi kflmiami420,

Sorry you're having issues with the IO Python library - I'm going to try to replicate this error from my end. Could you please post your entire code (with adafruit io credentials omitted)?

Code: Select all | TOGGLE FULL SIZE
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0xb5d59990>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

This error means that a DNS error occurred and the urllib/requests library was unable to resolve the IP address. Is your Raspberry Pi connected to a VPN? Do you have a firewall on your network?

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Tue Oct 29, 2019 4:17 pm

Sure ,

I have both sensors wired to the same Raspberry Pi Zero W

But they are running two different scripts one is for the DHT22 and the other is for the BME280

Code: Select all | TOGGLE FULL SIZE
import time
import Adafruit_DHT
from Adafruit_IO import Client, Feed

DHT_DATA_PIN = 10
LOOP_Delay = 35
ADAFRUIT_IO_KEY = 'KEY Numbers go here '
ADAFRUIT_IO_USERNAME = 'USER name goes here'
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

try: # if we already have the feeds, assign them.
    temperature_feed = aio.feeds('temperature')
    humidity_feed = aio.feeds('humidity')

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'))

dht22_sensor = Adafruit_DHT.DHT22

while True:
 
    humidity, temperature = Adafruit_DHT.read_retry(dht22_sensor, DHT_DATA_PIN)
    temperature = temperature * 9/5.0 + 32
    humidity = humidity + 7


#    print('Temp={0:0.1f}*F Humidity={1:0.1f}%'.format(temperature, humidity))
    print('sending DHT22 data to adafruit io...')
    print('Temperature: %0.1f F' % temperature)
    aio.send(temperature_feed.key, '{0:.2f} F'.format(temperature))
    print("Humidity: %0.1f %%" % humidity)
    aio.send(humidity_feed.key, '{0:.2f} %   '.format(humidity))

    time.sleep(90)


This is for the DHT22 sensor . Do you think I need to combine the DHT22 and BME280 into one to eliminate the error ?


This is the BME280 to Adafruit IO code

Code: Select all | TOGGLE FULL SIZE
#Author(s): Brent Rubell for Adafruit Industries
#Copyright (c) 2018 Adafruit Industries
#Licensed under the MIT license.
#All text above must be included in any redistribution.
#Re edited by KFLMIAMI420
# BME280 on rasperry pi zero w running debian buster October, 2019
# Take readings from a BME280 Sensor attached to a Raspberry Pi Zero W
# Print readings to Terminal Window
# Upload readings to Adafruit IO IOT Portal
# Convert Raw readings from C to F
# Add Decimal to Altitude upload to IO Portal
# Add Humidity correction for Sensor Error
import time
import board
import busio
import adafruit_bme280

from Adafruit_IO import Client, Feed, RequestError
LOOP_DELAY = 0
ADAFRUIT_IO_KEY = 'Key numbers go here '
ADAFRUIT_IO_USERNAME = 'User name goes here '
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

try: # if we already have the feeds, assign them.
    temperature_feed = aio.feeds('temperature2')
    humidity_feed = aio.feeds('humidity2')
    pressure_feed = aio.feeds('pressure2')
    altitude_feed = aio.feeds('altitude2')
except RequestError: # if we don't, create and assign them.
    temperature_feed = aio.create_feed(Feed(name='temperature2'))
    humidity_feed = aio.create_feed(Feed(name='humidity2'))
    pressure_feed = aio.create_feed(Feed(name='pressure2'))
    altitude_feed = aio.create_feed(Feed(name='altitude2'))

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
bme280.sea_level_pressure = 1017.02
while True:
    print('Reading BME280 Sensor...')
#    time.sleep (2)
    temperature_data = bme280.temperature
    # convert temperature (C->F)
    temperature_data = int(temperature_data) * 1.8 + 32
    humid_data = bme280.humidity
    # humidity correction for sensor error. for better  readings get readings from DHT22 humidity on this hat
    humid_data = int(humid_data) + 10
    pressure_data = bme280.pressure
    alt_data = bme280.altitude

    print('Sending BME280 data to adafruit io...')
#    time.sleep (2)
    print('Temperature: %0.1f F' % temperature_data)
    aio.send(temperature_feed.key, '{0:.2f} F'.format(temperature_data))
    print("Humidity: %0.1f %%" % humid_data)
    aio.send(humidity_feed.key, '{0:.2f} % '.format(humid_data))
    print("Pressure: %0.1f hPa" % pressure_data)
    aio.send(pressure_feed.key, '{0:.2f} Mbar'.format(pressure_data))
    print("Altitude = %0.2f meters" % alt_data)
    aio.send(altitude_feed.key, '{0:.2f} meters'.format(alt_data))

    time.sleep(100)



To answer your questions

No VPN

Just a basic Xfinity modem to a Wifi Router

The Raspberry Pi Zero W does have a Static IP address

I do have separate Pi hole Raspberry Pi Zero W on a different static IP address > Should I white list io.adafruit.com ?

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

Re: I am getting errors on my Pi Zero W

by brubell on Tue Oct 29, 2019 4:40 pm

This is for the DHT22 sensor . Do you think I need to combine the DHT22 and BME280 into one to eliminate the error ?

No, because the issue you're running into is with a library dependency and not something within the sensor code.



I do have separate Pi hole Raspberry Pi Zero W on a different static IP address > Should I white list io.adafruit.com ?


Could you temporarily disable the Pi-Hole to see if it's causing a network issue? You could try ping'ing io.adafruit.com from your Pi first, to see if it can resolve the IP address directly.

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Tue Oct 29, 2019 6:20 pm

Ok I have Disabled My Hole Device

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

Re: I am getting errors on my Pi Zero W

by brubell on Wed Oct 30, 2019 9:44 am

kflmiami420 wrote:Ok I have Disabled My Hole Device


Are you hitting the same error?

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Wed Oct 30, 2019 2:20 pm

Yes Same issue

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Thu Oct 31, 2019 1:20 pm

I whitelisted IO.ADAFRUIT.COM It seems to help so far no errors in 4 hours of testing .


What data is io.adafruit.com collecting that a pihole Pi would interrupt the uploads ?

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

Re: I am getting errors on my Pi Zero W

by brubell on Thu Oct 31, 2019 1:52 pm

kflmiami420 wrote:I whitelisted IO.ADAFRUIT.COM It seems to help so far no errors in 4 hours of testing .


What data is io.adafruit.com collecting that a pihole Pi would interrupt the uploads ?


We've had success with a Raspberry Pi, Pi-Hole and Adafruit IO before.

However, I'm not sure what sites/DNS servers the PiHole was configured to block. This could be something particular about the Pi Hole setup, or about how your Raspberry Pi W was setup.

What filter list(s) did you select for your Pi-Hole? Possibly the list is blocking AWS hosts or Cloudflare.
Last edited by brubell on Thu Oct 31, 2019 2:59 pm, edited 1 time in total.
Reason: edited to be more concise

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Wed Nov 06, 2019 7:57 pm

Still have the errors

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

Re: I am getting errors on my Pi Zero W

by brubell on Mon Nov 11, 2019 4:46 pm

kflmiami420 wrote:Still have the errors

Are you still using the Pi Hole, or are you trying a different network setup? Are the errors you're receiving still related to the DNS resolution for io.adafruit.com?

What filter list(s) did you select for your Pi-Hole?

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Tue Nov 12, 2019 7:23 pm

I just set up the pi hole per your tutorial and chose one of them not the first one . i was getting all kinds of traffic from all the wifi automation switches and plugs , alexa so I started blacklisting all the traffic until things stopped working . Very few White listed domains added but in there are Adafruit , IOAdafruit , Discord, Github, Raspberrypi.org, Twitter, Ebay , Amazon.com .


You mentioned in a previous post that adafruit IO works with AWS ? Do you have those domains so I can look those up .

at this point Raspberry Pi weather Sensors with IOAdafruit is just works if I am sitting watching the terminal screen to look for the port 443 errors and restart the scripts

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

Re: I am getting errors on my Pi Zero W

by brubell on Wed Nov 13, 2019 11:22 am

. i was getting all kinds of traffic from all the wifi automation switches and plugs , alexa so I started blacklisting all the traffic until things stopped working .

Could you try resetting your Pi-Hole config to it's initial configuration?

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

Re: I am getting errors on my Pi Zero W

by kflmiami420 on Fri Nov 22, 2019 2:58 pm

Thank you for all the help Brubell

I have given up on IO Adafruit . I decided to use another Pi Hole and the same occurs. I will just use a different platform

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

Please be positive and constructive with your questions and comments.