diff --git a/homeassistant/components/notify/html5.py b/homeassistant/components/notify/html5.py
index a979ab5fb2f5dd..f97a4ebb864cc9 100644
--- a/homeassistant/components/notify/html5.py
+++ b/homeassistant/components/notify/html5.py
@@ -5,6 +5,7 @@
https://home-assistant.io/components/notify.html5/
"""
import asyncio
+from copy import deepcopy
import datetime
import json
import logging
@@ -133,17 +134,6 @@ def _load_config(filename):
return {}
-class JSONBytesDecoder(json.JSONEncoder):
- """JSONEncoder to decode bytes objects to unicode."""
-
- # pylint: disable=method-hidden
- def default(self, obj):
- """Decode object if it's a bytes object, else defer to base class."""
- if isinstance(obj, bytes):
- return obj.decode()
- return json.JSONEncoder.default(self, obj)
-
-
class HTML5PushRegistrationView(HomeAssistantView):
"""Accepts push registrations from a browser."""
@@ -408,8 +398,12 @@ def send_message(self, message="", **kwargs):
jwt_token = jwt.encode(jwt_claims, jwt_secret).decode('utf-8')
payload[ATTR_DATA][ATTR_JWT] = jwt_token
- response = WebPusher(info[ATTR_SUBSCRIPTION]).send(
- json.dumps(payload), gcm_key=self._gcm_key, ttl='86400')
+ # Deepcopy here because WebPusher alters our reference with byte()
+ # Remove deepcopy when pywebpush releases a new version (>1.4.0)
+ # See https://github.com/home-assistant/home-assistant/pull/11437
+ subscription = deepcopy(info[ATTR_SUBSCRIPTION])
+ response = WebPusher(subscription).send(
+ json.dumps(payload), gcm_key=self._gcm_key, ttl=86400)
# pylint: disable=no-member
if response.status_code == 410: