mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
* Add scripts to auto update strings.json and services.yaml * Run services * simplify * Run strings * rerun * revert * allow unicode * Add CODEOWNERS * Update CODEOWNERS * set CONF_USE_DEFAULTS docs * add field_name * Auto run scripts * Update desc * Update README.md, strings.json, and services.yaml * double quotes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md, strings.json, and services.yaml * Add newline * sync changes between en.json and strings.json * Update README.md, strings.json, and services.yaml * double quotes * fix * Update README.md, strings.json, and services.yaml * Add comments * Remove comments * shorter * Update README.md, strings.json, and services.yaml * Rephrase * Update README.md, strings.json, and services.yaml * remove key from desc --------- Co-authored-by: Benjamin Auquite <halomastar@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
25 lines
896 B
Python
25 lines
896 B
Python
from pathlib import Path
|
|
import sys
|
|
|
|
import yaml
|
|
|
|
sys.path.append(str(Path(__file__).parent.parent))
|
|
|
|
from custom_components.adaptive_lighting import const # noqa: E402
|
|
|
|
services_filename = "custom_components/adaptive_lighting/services.yaml"
|
|
with open(services_filename) as f:
|
|
services = yaml.safe_load(f)
|
|
|
|
for service_name, dct in services.items():
|
|
_docs = {"set_manual_control": const.DOCS_MANUAL_CONTROL, "apply": const.DOCS_APPLY}
|
|
alternative_docs = _docs.get(service_name, const.DOCS)
|
|
for field_name, field in dct["fields"].items():
|
|
description = alternative_docs.get(field_name, const.DOCS[field_name])
|
|
field["description"] = description
|
|
|
|
comment = "# This file is auto-generated by .github/update-services.py."
|
|
|
|
with open(services_filename, "w") as f:
|
|
f.write(comment + "\n")
|
|
yaml.dump(services, f, sort_keys=False, width=1000, allow_unicode=True)
|