Use load_json_object in html5 (#88586)
This commit is contained in:
parent
209278d423
commit
db6dba87e5
1 changed files with 3 additions and 6 deletions
|
@ -35,7 +35,7 @@ from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.json import save_json
|
from homeassistant.helpers.json import save_json
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util import ensure_unique_string
|
from homeassistant.util import ensure_unique_string
|
||||||
from homeassistant.util.json import load_json
|
from homeassistant.util.json import JsonObjectType, load_json_object
|
||||||
|
|
||||||
from .const import DOMAIN, SERVICE_DISMISS
|
from .const import DOMAIN, SERVICE_DISMISS
|
||||||
|
|
||||||
|
@ -175,9 +175,6 @@ def get_service(
|
||||||
|
|
||||||
registrations = _load_config(json_path)
|
registrations = _load_config(json_path)
|
||||||
|
|
||||||
if registrations is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
vapid_pub_key = config[ATTR_VAPID_PUB_KEY]
|
vapid_pub_key = config[ATTR_VAPID_PUB_KEY]
|
||||||
vapid_prv_key = config[ATTR_VAPID_PRV_KEY]
|
vapid_prv_key = config[ATTR_VAPID_PRV_KEY]
|
||||||
vapid_email = config[ATTR_VAPID_EMAIL]
|
vapid_email = config[ATTR_VAPID_EMAIL]
|
||||||
|
@ -197,10 +194,10 @@ def get_service(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _load_config(filename):
|
def _load_config(filename: str) -> JsonObjectType:
|
||||||
"""Load configuration."""
|
"""Load configuration."""
|
||||||
with suppress(HomeAssistantError):
|
with suppress(HomeAssistantError):
|
||||||
return load_json(filename)
|
return load_json_object(filename)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue