Very unreliable html5 notifications

I’ve posted this without any real help: HTML5 push notifications not working on Firefox

After that I’ve updated to 0.61 hoping it would fix some things. However, now even my Android/Chrome notifications are horrible. They either do not show, or very slowly. Can’t even use it now!

Error executing service <ServiceCall notify.html5: message=<homeassistant.helpers.template.Template object at 0x7f607dd0c630>>

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File “/usr/local/lib/python3.6/socket.py”, line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 601, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 346, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 850, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f6084cfb710>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 440, in send
timeout=timeout
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘android.googleapis.com’, port=443): Max retries exceeded with url: /gcm/send (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6084cfb710>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/core.py”, line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File “/usr/src/app/homeassistant/components/notify/init.py”, line 137, in async_notify_message
yield from notify_service.async_send_message(**kwargs)
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 327, in iter
yield self # This tells Task to wait for completion.
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 243, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/notify/html5.py”, line 412, in send_message
json.dumps(payload), gcm_key=self._gcm_key, ttl=‘86400’)
File “/usr/local/lib/python3.6/site-packages/pywebpush/init.py”, line 301, in send
timeout=timeout)
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 112, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 618, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘android.googleapis.com’, port=443): Max retries exceeded with url: /gcm/send (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6084cfb710>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

What about Chrome?

I noticed a month back that I couldn’t get notification to Firefox registered device although it is in registration file.

Chrome is very hit and miss since 0.61, and Firefox has never worked for me.

Also, my conf file with tokens has over 300 duplicates!

Anyone? Can’t be alone.

I’ve been having problems getting all my notifications with HTML5 also. I thought my Android phone was just going to sleep and Chrome wasn’t allowed to wake it to receive notifications, but then found this error just now in my logs. I’m on 0.64.3. My RP3b is on wifi, I’m using Google wifi with great coverage, but I’ll try direct wiring to see if that fixes the issue.

Log Details (ERROR)
Fri Mar 23 2018 17:28:25 GMT-0400 (Eastern Daylight Time)

Error executing service <ServiceCall notify.chromepush_marc_phone: message=<homeassistant.helpers.template.Template object at 0x6ef578f0>>
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/lib/python3.6/site-packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/usr/lib/python3.6/site-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/urllib3/connectionpool.py”, line 601, in urlopen
chunked=chunked)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 346, in _make_request
self._validate_conn(conn)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 850, in _validate_conn
conn.connect()
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x72985e90>: 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 440, in send
timeout=timeout
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/lib/python3.6/site-packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘android.googleapis.com’, port=443): Max retries exceeded with url: /gcm/send (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x72985e90>: 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/homeassistant/core.py”, line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File “/usr/lib/python3.6/site-packages/homeassistant/components/notify/init.py”, line 137, in async_notify_message
yield from notify_service.async_send_message(**kwargs)
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.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/notify/html5.py”, line 412, in send_message
json.dumps(payload), gcm_key=self._gcm_key, ttl=‘86400’)
File “/usr/lib/python3.6/site-packages/pywebpush/init.py”, line 301, in send
timeout=timeout)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 112, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 618, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘android.googleapis.com’, port=443): Max retries exceeded with url: /gcm/send (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x72985e90>: Failed to establish a new connection: [Errno 101] Network unreachable’,))

I pulled the SD card from my RP3, manually disabled the wifi, booted my RP3 backup with a network cord connected. I get the same issue when testing pushing a message via HTML5. Most of the time they go thru, but this time, the first one didn’t. Checking the logs, I see I got a “Timer got out of sync. Resetting” error just before the notify error claiming network was unavailable. After that they go thru reliably for now. I’ll start digging into this timer got out of sync error.

Timer got out of sync. Resetting
6:21 PM core.py (ERROR)

Error executing service <ServiceCall notify.chromepush_marc_phone: message=<homeassistant.helpers.template.Template object at 0x73742350>>
6:21 PM components/notify/html5.py (ERROR)

Why I dont get HTML5 notification via Chrome when device-android is in sleep longer than 15min?