Add missing type information for panel_custom (#71122)

This commit is contained in:
Marvin Wichmann 2022-05-01 13:21:27 +02:00 committed by GitHub
parent ef09e89006
commit 6e1b787ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
"""Register a custom front end panel."""
from __future__ import annotations
import logging
import voluptuous as vol
@ -70,27 +72,27 @@ CONFIG_SCHEMA = vol.Schema(
@bind_hass
async def async_register_panel(
hass,
hass: HomeAssistant,
# The url to serve the panel
frontend_url_path,
frontend_url_path: str,
# The webcomponent name that loads your panel
webcomponent_name,
webcomponent_name: str,
# Title/icon for sidebar
sidebar_title=None,
sidebar_icon=None,
sidebar_title: str | None = None,
sidebar_icon: str | None = None,
# JS source of your panel
js_url=None,
js_url: str | None = None,
# JS module of your panel
module_url=None,
module_url: str | None = None,
# If your panel should be run inside an iframe
embed_iframe=DEFAULT_EMBED_IFRAME,
embed_iframe: bool = DEFAULT_EMBED_IFRAME,
# Should user be asked for confirmation when loading external source
trust_external=DEFAULT_TRUST_EXTERNAL,
trust_external: bool = DEFAULT_TRUST_EXTERNAL,
# Configuration to be passed to the panel
config=None,
config: ConfigType | None = None,
# If your panel should only be shown to admin users
require_admin=False,
):
require_admin: bool = False,
) -> None:
"""Register a new custom panel."""
if js_url is None and module_url is None:
raise ValueError("Either js_url, module_url or html_url is required.")