mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
Remove lovelace from mypy ignore list (#75167)
* Remove lovelace from mypy ignore list * Raise error on failed config
This commit is contained in:
parent
28c082a080
commit
c260413e2a
@ -86,11 +86,15 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
||||
config = await async_process_component_config(hass, conf, integration)
|
||||
|
||||
if config is None:
|
||||
raise HomeAssistantError("Config validation failed")
|
||||
|
||||
resource_collection = await create_yaml_resource_col(
|
||||
hass, config[DOMAIN].get(CONF_RESOURCES)
|
||||
)
|
||||
hass.data[DOMAIN]["resources"] = resource_collection
|
||||
|
||||
default_config: dashboard.LovelaceConfig
|
||||
if mode == MODE_YAML:
|
||||
default_config = dashboard.LovelaceYAML(hass, None, None)
|
||||
resource_collection = await create_yaml_resource_col(hass, yaml_resources)
|
||||
@ -179,8 +183,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
# Process YAML dashboards
|
||||
for url_path, dashboard_conf in hass.data[DOMAIN]["yaml_dashboards"].items():
|
||||
# For now always mode=yaml
|
||||
config = dashboard.LovelaceYAML(hass, url_path, dashboard_conf)
|
||||
hass.data[DOMAIN]["dashboards"][url_path] = config
|
||||
lovelace_config = dashboard.LovelaceYAML(hass, url_path, dashboard_conf)
|
||||
hass.data[DOMAIN]["dashboards"][url_path] = lovelace_config
|
||||
|
||||
try:
|
||||
_register_panel(hass, url_path, MODE_YAML, dashboard_conf, False)
|
||||
|
@ -7,7 +7,7 @@ import uuid
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_RESOURCES, CONF_TYPE
|
||||
from homeassistant.const import CONF_ID, CONF_RESOURCES, CONF_TYPE
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import collection, storage
|
||||
@ -94,7 +94,7 @@ class ResourceStorageCollection(collection.StorageCollection):
|
||||
conf.pop(CONF_RESOURCES)
|
||||
|
||||
for item in data:
|
||||
item[collection.CONF_ID] = uuid.uuid4().hex
|
||||
item[CONF_ID] = uuid.uuid4().hex
|
||||
|
||||
data = {"items": data}
|
||||
|
||||
|
@ -45,8 +45,8 @@ def _handle_errors(func):
|
||||
return send_with_error_handling
|
||||
|
||||
|
||||
@websocket_api.async_response
|
||||
@websocket_api.websocket_command({"type": "lovelace/resources"})
|
||||
@websocket_api.async_response
|
||||
async def websocket_lovelace_resources(hass, connection, msg):
|
||||
"""Send Lovelace UI resources over WebSocket configuration."""
|
||||
resources = hass.data[DOMAIN]["resources"]
|
||||
@ -58,7 +58,6 @@ async def websocket_lovelace_resources(hass, connection, msg):
|
||||
connection.send_result(msg["id"], resources.async_items())
|
||||
|
||||
|
||||
@websocket_api.async_response
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
"type": "lovelace/config",
|
||||
@ -66,6 +65,7 @@ async def websocket_lovelace_resources(hass, connection, msg):
|
||||
vol.Optional(CONF_URL_PATH): vol.Any(None, cv.string),
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@_handle_errors
|
||||
async def websocket_lovelace_config(hass, connection, msg, config):
|
||||
"""Send Lovelace UI config over WebSocket configuration."""
|
||||
@ -73,7 +73,6 @@ async def websocket_lovelace_config(hass, connection, msg, config):
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.async_response
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
"type": "lovelace/config/save",
|
||||
@ -81,6 +80,7 @@ async def websocket_lovelace_config(hass, connection, msg, config):
|
||||
vol.Optional(CONF_URL_PATH): vol.Any(None, cv.string),
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@_handle_errors
|
||||
async def websocket_lovelace_save_config(hass, connection, msg, config):
|
||||
"""Save Lovelace UI configuration."""
|
||||
@ -88,13 +88,13 @@ async def websocket_lovelace_save_config(hass, connection, msg, config):
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.async_response
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
"type": "lovelace/config/delete",
|
||||
vol.Optional(CONF_URL_PATH): vol.Any(None, cv.string),
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@_handle_errors
|
||||
async def websocket_lovelace_delete_config(hass, connection, msg, config):
|
||||
"""Delete Lovelace UI configuration."""
|
||||
|
12
mypy.ini
12
mypy.ini
@ -2668,18 +2668,6 @@ ignore_errors = true
|
||||
[mypy-homeassistant.components.evohome.climate]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.lovelace]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.lovelace.dashboard]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.lovelace.resources]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.lovelace.websocket]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.minecraft_server]
|
||||
ignore_errors = true
|
||||
|
||||
|
@ -20,10 +20,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||
"homeassistant.components.cloud.http_api",
|
||||
"homeassistant.components.evohome",
|
||||
"homeassistant.components.evohome.climate",
|
||||
"homeassistant.components.lovelace",
|
||||
"homeassistant.components.lovelace.dashboard",
|
||||
"homeassistant.components.lovelace.resources",
|
||||
"homeassistant.components.lovelace.websocket",
|
||||
"homeassistant.components.minecraft_server",
|
||||
"homeassistant.components.minecraft_server.helpers",
|
||||
"homeassistant.components.minecraft_server.sensor",
|
||||
|
Loading…
x
Reference in New Issue
Block a user