supervisor: "Cannot connect to host" with Google, Telegram, Yahoo...

After update to 0.60.2, hassio can’t connect to online apis and services.

Thread on forum : https://community.home-assistant.io/t/strange-cannot-connect-to-host-issue/37467

Google calendar :

2018-01-10 14:07:20 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up platform google
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 995, in _conn_request
    conn.connect()
  File "/usr/lib/python3.6/http/client.py", line 1392, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/google.py", line 39, in setup_platform
    for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/google.py", line 39, in <listcomp>
    for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/google.py", line 49, in __init__
    super().__init__(hass, data)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/__init__.py", line 72, in __init__
    self.update()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/__init__.py", line 138, in update
    if not self.data or not self.data.update():
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/calendar/google.py", line 65, in update
    service = self.calendar_service.get()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/google.py", line 249, in get
    'calendar', 'v3', http=http, cache_discovery=False)
  File "/usr/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/googleapiclient/discovery.py", line 229, in build
    requested_url, discovery_http, cache_discovery, cache)
  File "/usr/lib/python3.6/site-packages/googleapiclient/discovery.py", line 276, in _retrieve_discovery_doc
    resp, content = http.request(actual_url)
  File "/usr/lib/python3.6/site-packages/oauth2client/transport.py", line 175, in new_request
    redirections, connection_type)
  File "/usr/lib/python3.6/site-packages/oauth2client/transport.py", line 282, in request
    connection_type=connection_type)
  File "/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1322, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1072, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1002, in _conn_request
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at www.googleapis.com

Google maps :

2018-01-10 14:31:52 ERROR (MainThread) [homeassistant.components.camera.generic] Error getting new camera image: Cannot connect to host maps.googleapis.com:443 ssl:True [Try again]

Telegram :

2018-01-10 14:32:00 ERROR (MainThread) [homeassistant.components.telegram_bot.polling] Cannot connect to host api.telegram.org:443 ssl:True [Try again]

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 42 (16 by maintainers)

Most upvoted comments

@prigal As a new HA user, I respectfully disagree. If there are known issues that affect the initial installation of HA (Step 3), then putting a note to fix the issue(like the 2.4GHz issue) will save a new user from having to scour the forums to figure out why the default sensors don’t work. If this would have been stated as an issue when setting up the wireless BEFORE(you can’t change it via ssh, so you have to take it back out of the RPI) inserting it into the RPI for the very first time would have saved me a lot of wasted time and headache. You may be pushing the DNS from your router, but per the instructions on the HA site, it doesn’t state that and is not something someone new to HA would know.

  1. “WiFi setup only: open the file system-connections/resin-sample (from the resin-boot volume on the SD card) with a text editor. Change ssid to be your network name and psk to be your password. Note that the Raspberry Pi 3 is a 2.4GHz WiFi device, so do not try to connect it to a 5GHz network.”

There’s a Note for connecting to 2.4GHz only as an issue. Another Note could be

The Docker container where Hassio is installed, only uses the 1st DNS entry. Set it to 8.8.8.8 if you’re not using your own DNS server."

It’s a small addition to the instructions for new HA users installing for WiFi only just to get the basic setup to actually work. If not, then they have to do a search in the forum (if they know what to search for), remove the card from the Pi, edit the resin_sample to add the DNS, and put it back into the Pi for something a simple addition to the instructions would alleviate. I couldn’t get weather underground to work(couldn’t reach the site), ecobee couldn’t be set up because it couldn’t get the pin, and api calls fail.

If you don’t want to put these in the installation instructions, then at least put a link to Known Installation Issues with forum links. This would save unneeded forum posts asking the same questions, or be searching the internet for a solution that should have been included in the instructions. Don’t get me wrong, I am all for new users seeking out their own knowledge for HA(and the learning curve) for things they want to do and how to do them, but initial installation shouldn’t be one of them. Help the new users out a little.

sorry for digging this up again. I’m facing the same issue, running PiHole on the same device (using the HASS.io add-on). Now I’m trying to set a static IP and did Google on how to do it on resin. The guide I found suggested to edit the config.json of the boot partition (which somehow didn’t work for me, since after a reboot everything was back to normal). In here I read something about editing the resin-sample file. Which way is considered best practice here? Thanks.

edit: managed to do it. In the end I didn’t use either of the two ways, since I found another guide simply using the network manager CLI tool

resin> nmcli connection edit
// pick the connection to edit from the list displayed
nmcli> remove ipv4.dns  
nmcli> set ipv4.ignore-auto-dns yes
nmcli> set ipv4.dns 1.1.1.1,8.8.8.8    
nmcli> save
nmcli> quit 

after that, reboot and you’re good to go. That way you even don’t need a static IP but can have your DHCP manage it for your

That is a docker issue. He use only the first DNS server.

You can fix it, if you router will send the correct working DNS settings.

Hello, I did not have time to look last night, will check tonight.