Revert "Allows defining list of attributes excluded from history in manifest.json" (#99300)
Revert "Allows defining list of attributes excluded from history in manifest.json (#99283)"
This reverts commit 0366e14630
.
This commit is contained in:
parent
fb4e93071e
commit
7e7cb15d5b
8 changed files with 21 additions and 72 deletions
|
@ -20,7 +20,6 @@ from . import (
|
|||
metadata,
|
||||
mqtt,
|
||||
mypy_config,
|
||||
recorder,
|
||||
requirements,
|
||||
services,
|
||||
ssdp,
|
||||
|
@ -40,7 +39,6 @@ INTEGRATION_PLUGINS = [
|
|||
json,
|
||||
manifest,
|
||||
mqtt,
|
||||
recorder,
|
||||
requirements,
|
||||
services,
|
||||
ssdp,
|
||||
|
|
|
@ -264,7 +264,6 @@ INTEGRATION_MANIFEST_SCHEMA = vol.Schema(
|
|||
vol.Optional("loggers"): [str],
|
||||
vol.Optional("disabled"): str,
|
||||
vol.Optional("iot_class"): vol.In(SUPPORTED_IOT_CLASSES),
|
||||
vol.Optional("recorder_excluded_attributes"): [str],
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
"""Generate recorder file."""
|
||||
from __future__ import annotations
|
||||
|
||||
from .model import Config, Integration
|
||||
from .serializer import format_python_namespace
|
||||
|
||||
|
||||
def generate_and_validate(integrations: dict[str, Integration]) -> str:
|
||||
"""Validate and generate recorder data."""
|
||||
|
||||
data: dict[str, set[str]] = {}
|
||||
|
||||
for domain in sorted(integrations):
|
||||
exclude_list = integrations[domain].manifest.get("recorder_excluded_attributes")
|
||||
|
||||
if not exclude_list:
|
||||
continue
|
||||
|
||||
data[domain] = set(exclude_list)
|
||||
|
||||
return format_python_namespace({"EXCLUDED_ATTRIBUTES": data})
|
||||
|
||||
|
||||
def validate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
"""Validate recorder file."""
|
||||
recorder_path = config.root / "homeassistant/generated/recorder.py"
|
||||
config.cache["recorder"] = content = generate_and_validate(integrations)
|
||||
|
||||
if config.specific_integrations:
|
||||
return
|
||||
|
||||
with open(str(recorder_path)) as fp:
|
||||
if fp.read() != content:
|
||||
config.add_error(
|
||||
"recorder",
|
||||
"File recorder.py is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
|
||||
|
||||
def generate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
"""Generate recorder file."""
|
||||
recorder_path = config.root / "homeassistant/generated/recorder.py"
|
||||
with open(str(recorder_path), "w") as fp:
|
||||
fp.write(f"{config.cache['recorder']}")
|
Loading…
Add table
Add a link
Reference in a new issue