It's ­čÉŹCircuitPython Monday­čÉŹ at Adafruit! Use the code ADATY to get 20% off CircuitPython and 15% off items storewide!
0

Could someone explain why I am getting this error please...
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.

Could someone explain why I am getting this error please...

by themusicman on Sat Oct 16, 2021 12:19 pm

Hi All at Adafruit

I am running a few Pi's which are independently uploading their BMP280 temperature readings to my Adafruit.io feed. I have ensured I am not exceeding my feed limit, but on one of the Pi's, a Raspberry Pi Zero W, I am frequently getting this error - notably, not on any of the other three Pi's.

Code: Select all | TOGGLE FULL SIZE
  raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/themusicman/feeds/pizerotemp/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb4d73d90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))


I wonder could an expert perhaps let me know what might be going wrong here please. Each of the Pi's are on the same home WiFi network, with the PiZero being closest to the router at only a few feet away. The code running on each is there same, apart of course from the Adafruit.io feed names etc. I have not included the import statements... but it all works fine.

Code: Select all | TOGGLE FULL SIZE
ADAFRUIT_IO_USERNAME = "removed"
ADAFRUIT_IO_KEY = "removed"

aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x76)

try:
    pizerotemp = aio.feeds('pizerotemp')
except RequestError:
    test_feed = Feed(name='pizerotemp')
    test_feed = aio.create_feed(test_feed)
   
try:
    pizeropressure = aio.feeds('pizeropressure')
except RequestError:
    test2_feed = Feed(name='pizeropressure')
    test2_feed = aio.create_feed(test2_feed)
   
while True:
   
    aio.send_data(pizerotemp.key, round(sensor.temperature, 1))
    aio.send_data(pizeropressure.key, round(sensor.pressure, 2))
    time.sleep(120)

Hope someone can shed some light on my issue, thanks all.
John

themusicman
 
Posts: 16
Joined: Fri Feb 15, 2019 4:27 pm

Re: Could someone explain why I am getting this error please

by AstroGuy on Sat Oct 16, 2021 3:31 pm

don't know why you need the toys and excepts code...maybe for other code not showing???

but I use aio.send not aio.send_data

don't know if this will help or not!!!

AstroGuy
 
Posts: 13
Joined: Mon Dec 15, 2014 1:42 pm

Re: Could someone explain why I am getting this error please

by themusicman on Sun Oct 17, 2021 2:55 am

AstroGuy wrote:don't know why you need the toys and excepts code...maybe for other code not showing???

but I use aio.send not aio.send_data

don't know if this will help or not!!!

Yep, I am pretty much messing around with different feeds etc, and if I were to inadvertently delete a feed on Adafruit then run this script the feed would be recreated.

Thanks for the suggestion, unfortunately changing the method doesn't result in this not happening. It happened overnight again last night which is very frustrating.

themusicman
 
Posts: 16
Joined: Fri Feb 15, 2019 4:27 pm

Re: Could someone explain why I am getting this error please

by brubell on Mon Oct 18, 2021 9:37 am

This means that the requests library failed to resolve the io.adafruit.com domain name. Please try the "1. Missing or Wrongly Configured resolv.conf File" step on https://www.tecmint.com/resolve-tempora ... resolution to append Google's DNS server onto your Pi's configuration list and let me know if it works for you.

If it doesn't, we can take some more steps to resolve it.

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

Re: Could someone explain why I am getting this error please

by themusicman on Sat Nov 06, 2021 4:14 am

brubell wrote:This means that the requests library failed to resolve the io.adafruit.com domain name. Please try the "1. Missing or Wrongly Configured resolv.conf File" step on https://www.tecmint.com/resolve-tempora ... resolution to append Google's DNS server onto your Pi's configuration list and let me know if it works for you.

If it doesn't, we can take some more steps to resolve it.

Many thanks brubell.

I did read your reply when you posted it but got distracted at the time and failed to make the change to the /etc/resolv.conf file. The issue happened again last night, but I have now made the change as stated in your link, I will monitor and hopefully this will resolve the issue (see what I did there :) )

themusicman
 
Posts: 16
Joined: Fri Feb 15, 2019 4:27 pm

Please be positive and constructive with your questions and comments.