home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.5k stars 30.7k forks source link

Vapid HTML5 notify : Error handling message ... #21310

Closed pergolafabio closed 5 years ago

pergolafabio commented 5 years ago

Home Assistant release with the issue:

Last working Home Assistant release (if known): Never tried it, always used GCM

Operating environment (Hass.io/Docker/Windows/etc.):

Component/platform:

Description of problem: I saw in release notes, vapid is supported, so changed from my working GCM to Vapid , but now receive error below when i test a message, see logs below

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

  - platform: html5
    name: html5
    vapid_pub_key: BLABLA
    vapid_prv_key: BLABLA
    vapid_email: my_email@gmail.com

Traceback (if applicable):

2019-02-22 13:56:38 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140451370971712] Error handling message: {'type': 'call_service', 'domain': 'notify', 'service': 'html5', 'service_data': {'message': 'test'}, 'id': 17}
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 147, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1133, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1155, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/__init__.py", line 117, in async_notify_message
    await notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/html5.py", line 451, in send_message
    self._push_message(payload, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/html5.py", line 488, in _push_message
    vapid_claims=self._vapid_claims
  File "/usr/local/lib/python3.7/site-packages/pywebpush/__init__.py", line 384, in webpush
    result, result.text))
pywebpush.WebPushException: Push failed: <Response [410]>: <HTML>
<HEAD>
<TITLE>NotRegistered</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>NotRegistered</H1>
<H2>Error 410</H2>
</BODY>
</HTML>
quazzie commented 5 years ago

Yeah i got the same, hade to re-register the devices.

pergolafabio commented 5 years ago

register the devices? explain?

pergolafabio commented 5 years ago

you mean delete this file? html5_push_registrations.conf ?

quazzie commented 5 years ago

Open homeassistant on the devices you want to receive notifications. Go to setting where you enable pushnotifications, uncheck/remove and then enable it again.

pergolafabio commented 5 years ago

ah ok, thnx ! gonna try it later

pergolafabio commented 5 years ago

that was it, thnx!!

derandiunddasbo commented 5 years ago

you mean delete this file? html5_push_registrations.conf ?

Just for the record: If this error persists after re-registering devices, it's most likely because <config>/html5_push_registrations.conf is still containing other devices that need to be re-registered, or duplicate entries for already re-registered devices which never get replaced, because of an other existing entry for the same device.

Thus, as the devices which have been registered before the vapid migration become invalid anyways and have to be re-registered, it's always a good idea to delete the html5_push_registrations.conf after changing the config to vapid to get rid of orphaned or duplicate entries for good.

Please delete this file while HA is stopped. Otherwise all duplicate and orphaned entries are rewritten, when a new device is registered, because this config is managed in RAM while HA is running.

pergolafabio commented 5 years ago

yes, have done it works already for 2 weeks, but seems it stopped today strange, will investigate further

pergolafabio commented 5 years ago

ok , working again, small glitch it seems