Connection.py maps.googleapis.com Error : VerifiedHTTPSConnection ,[Errno 101] Network unreachable

i keep getting this error . but the google maps sensor seams to work
.
has any one any idea why or how to fix it ?

2017-09-22 12:22:59 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.to_workcar fails
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f041dd02f98>: Failed to establish a new connection: [Errno 101] Network unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 438, in send
timeout=timeout
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py”, line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/lib/python3.6/site-packages/requests/packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘maps.googleapis.com’, port=443): Max retries exceeded with url: /maps/api/distancematrix/json?departure_time=now&destinations=DESTINATION&mode=driving&origins=STARTPOINT&units=metric&key=APIKEY (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f041dd02f98>: Failed to establish a new connection: [Errno 101] Network unreachable’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/googlemaps/client.py”, line 229, in _request
**final_requests_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 531, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 518, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 639, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 502, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘maps.googleapis.com’, port=443): Max retries exceeded with url: /maps/api/distancematrix/json?departure_time=now&destinations=DESTINATION&mode=driving&origins=STARTPOINT&units=metric&key=APIKEY (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f041dd02f98>: Failed to establish a new connection: [Errno 101] Network unreachable’,))DESTINATION

I am also getting this error on any request out to the internet eg any weather sensor. I have duckdns, let encrypt, Mqtt, owntracks, dnsmasq installed and they all seem to be running fine but I suspect the all internet connection requests going out are to an address on port 443 which might be wrong. Is this something to do with ssl or dnsmasq or a router setting?

It seems to be dnsmasq which seems to be causing the problem as when I stop the addon everything works again.

How should my dnsmasq configuration be like? I have the following…

{
“defaults”: [
“my isp server dns”,
“8.8.8.8”
],
“forwards”: [
{
“domain”: “hassio.local”,
“server”: “192.168.1.2”
}
],
“hosts”: [
{
“host”: “myservername.duckdns.org”,
“ip”: “192.168.1.2”
}
]
}

well i don’t have dnsmasq :stuck_out_tongue:

I am not using dnsmasq either and am seeing MANY connection errors (not 100% erros, but many). Any suggestions?

I have a similar problem. Sometimes, there seems to be a complete blocking of all outgoing connections from HA, when dnsmasq is enabled.

Did you ever figure out what was causing your issue?

For me it was dnsmasq which was the problem. I found out if you disable the component the connections could get out and then reenable the component things would work for a while until somthing times out. In the end my router was replaced as part of an upgrade which allowed internal forwarding which meant I didn’t need to use dnsmasq anymore.