Fix length of descriptions in UI (config flow) (#732)

* Fix length of strings in UI

* Update README.md, strings.json, and services.yaml

* fix

* add desc

* Update README.md, strings.json, and services.yaml

* mention webapp

* Add desc

* link

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Bas Nijholt 2023-08-09 17:17:25 -07:00 committed by GitHub
commit 5b7ee44629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 47 deletions

View file

@ -3,6 +3,7 @@ import json
import sys
from pathlib import Path
import homeassistant.helpers.config_validation as cv
import yaml
sys.path.append(str(Path(__file__).parent.parent))
@ -16,8 +17,17 @@ with strings_fname.open() as f:
strings = json.load(f)
# Set "options"
data = {k: f"{k}: {const.DOCS[k]}" for k, _, _ in const.VALIDATION_TUPLES}
data = {}
data_description = {}
for k, _, typ in const.VALIDATION_TUPLES:
desc = const.DOCS[k]
if len(desc) > 40 and typ != bool and typ != cv.entity_ids:
data[k] = k
data_description[k] = desc
else:
data[k] = f"{k}: {desc}"
strings["options"]["step"]["init"]["data"] = data
strings["options"]["step"]["init"]["data_description"] = data_description
# Set "services"
services_filename = Path("custom_components") / "adaptive_lighting" / "services.yaml"
@ -48,6 +58,7 @@ with en_fname.open() as f:
en["config"]["step"]["user"] = strings["config"]["step"]["user"]
en["options"]["step"]["init"]["data"] = data
en["options"]["step"]["init"]["data_description"] = data_description
en["services"] = services_json
with en_fname.open("w") as f: