Error saving html5 push config

When I try to register my android device from chrome I see the following in the log:

2017-11-21 20:59:28 ERROR (MainThread) [homeassistant.util.json] Failed to serialize to JSON: /home/homeassistant/.homeassistant/html5_push_registrations.conf
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/json.py", line 38, in save_json
    data = json.dumps(config, sort_keys=True, indent=4)
  File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 200, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.5/json/encoder.py", line 429, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 436, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'pRNH7pFGQ18HbYmRK0motQ==' is not JSON serializable
2017-11-21 20:59:28 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/json.py", line 38, in save_json
    data = json.dumps(config, sort_keys=True, indent=4)
  File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 200, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.5/json/encoder.py", line 429, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 403, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.5/json/encoder.py", line 436, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'pRNH7pFGQ18HbYmRK0motQ==' is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 416, in start
    resp = yield from self._request_handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web.py", line 323, in _handle
    resp = yield from handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware
    return (yield from handler(request))
  File "/usr/lib/python3.5/asyncio/coroutines.py", line 209, in coro
    res = yield from res
  File "/usr/lib/python3.5/asyncio/coroutines.py", line 209, in coro
    res = yield from res
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 430, in handle
    result = yield from result
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/notify/html5.py", line 176, in post
    if not save_json(self.json_path, self.registrations):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/json.py", line 45, in save_json
    raise HomeAssistantError(error)
homeassistant.exceptions.HomeAssistantError: b'pRNH7pFGQ18HbYmRK0motQ==' is not JSON serializable

In the html5 conf file I only see 1 entry from my desktop machine. The notifications to my phone work until I restart, then they stop working until I re-register.

2 Likes

Still stuck!

Found this older issue, that is closed, but it seems to be back:
https://github.com/home-assistant/home-assistant/issues/4012

I submitted a new one:
https://github.com/home-assistant/home-assistant/issues/10751

Any assistance would be great, it’s driving me nuts.

Thank you for submitting a new issue- I’m experiencing the same thing. I only noticed it once a family member got a new phone.

Same here.

Edit. I also get “Failed to serialize to JSON: /config/html5_push_registrations.conf” when i try to deregister a chrome browser on windows.

+1 facing this issue:
TypeError: b’######EDITED#########’ is not JSON serializable

+1 me too.