mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-16 08:44:03 +02:00
Delete upstream docs apparatus; rewrite README for the fork
The CDiT fork is single-household and was carrying an entire upstream docs/ mkdocs site documenting features the fork has removed (sleep mode, take-over-control, brightness_mode selector, YAML config). The README mostly auto-generated from those pages via markdown-code-runner. What's gone: - docs/ — all 11 pages + assets + run_markdown_code_runner.py - .github/workflows/docs.yml — zensical+shinylive GitHub Pages build - .github/workflows/markdown-code-runner.yml — auto-edit of README from docs/ - .github/update-services.py / update-strings.py — would clobber the hand-edited services.yaml / strings.json - scripts/update-generated-content — orchestrator for the above - custom_components/adaptive_lighting/_docs_helpers.py + docs_gen.py — only used by the deleted markdown-code-runner - zensical.toml — docs-site config - "docs" dependency group in pyproject.toml (markdown-code-runner, shinylive, zensical, etc.) + lock regenerated What's new: - README.md rewritten to describe the fork's actual surface — 3 switches, 4 number entities, 3 sensor entities per profile, 2 services (apply + change_switch_settings), entry-only setup, UI tuning, sun source. Preserves the existing "What's new in 2.1" / "2.2" block quotes. - webapp/README.md annotated to flag the Shiny simulator models the upstream curve (with brightness_mode, sleep mode, etc.) and does not reflect the fork. - CLAUDE.md command table no longer references update-generated-content. Sensor.py + test_sensor_platform.py: incidental black reformat from the lint pass (multi-arg function calls split per line). Tests still pass (123/123). Lint clean. Sensors implementation unchanged.
This commit is contained in:
parent
1b21228b30
commit
bba0ef31d8
31 changed files with 165 additions and 2999 deletions
27
.github/update-services.py
vendored
27
.github/update-services.py
vendored
|
|
@ -1,27 +0,0 @@
|
|||
"""Creates a services.yaml file with the latest docs."""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
sys.path.append(str(Path(__file__).parent.parent))
|
||||
|
||||
from custom_components.adaptive_lighting import const
|
||||
|
||||
services_filename = Path("custom_components") / "adaptive_lighting" / "services.yaml"
|
||||
with open(services_filename) as f: # noqa: PTH123
|
||||
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 services_filename.open("w") as f:
|
||||
f.write(comment + "\n")
|
||||
yaml.dump(services, f, sort_keys=False, width=1000, allow_unicode=True)
|
||||
70
.github/update-strings.py
vendored
70
.github/update-strings.py
vendored
|
|
@ -1,70 +0,0 @@
|
|||
"""Update strings.json and en.json from const.py."""
|
||||
|
||||
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))
|
||||
|
||||
from custom_components.adaptive_lighting import const
|
||||
|
||||
folder = Path("custom_components") / "adaptive_lighting"
|
||||
strings_fname = folder / "strings.json"
|
||||
en_fname = folder / "translations" / "en.json"
|
||||
with strings_fname.open() as f:
|
||||
strings = json.load(f)
|
||||
|
||||
# Set "options"
|
||||
data = {}
|
||||
data_description = {}
|
||||
for k, _, typ in const.VALIDATION_TUPLES:
|
||||
desc = const.DOCS[k]
|
||||
if len(desc) > 40 and typ not in (bool, 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"
|
||||
with open(services_filename) as f: # noqa: PTH123
|
||||
services = yaml.safe_load(f)
|
||||
services_json = {}
|
||||
for service_name, dct in services.items():
|
||||
services_json[service_name] = {
|
||||
"name": service_name,
|
||||
"description": dct["description"],
|
||||
"fields": {},
|
||||
}
|
||||
for field_name, field in dct["fields"].items():
|
||||
services_json[service_name]["fields"][field_name] = {
|
||||
"description": field["description"],
|
||||
"name": field_name,
|
||||
}
|
||||
strings["services"] = services_json
|
||||
|
||||
# Write changes to strings.json
|
||||
with strings_fname.open("w") as f:
|
||||
json.dump(strings, f, indent=2, ensure_ascii=False)
|
||||
f.write("\n")
|
||||
|
||||
# Sync changes from strings.json to en.json
|
||||
with en_fname.open() as f:
|
||||
en = json.load(f)
|
||||
|
||||
en["config"]["step"]["user"] = strings["config"]["step"]["user"]
|
||||
en["options"]["step"]["init"]["data"] = data
|
||||
en["options"]["step"]["init"]["data_description"] = data_description
|
||||
en["options"]["step"]["init"]["description"] = strings["options"]["step"]["init"][
|
||||
"description"
|
||||
]
|
||||
en["services"] = services_json
|
||||
|
||||
with en_fname.open("w") as f:
|
||||
json.dump(en, f, indent=2, ensure_ascii=False)
|
||||
f.write("\n")
|
||||
64
.github/workflows/docs.yml
vendored
64
.github/workflows/docs.yml
vendored
|
|
@ -1,64 +0,0 @@
|
|||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.14.2'
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v8.1.0
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --group docs
|
||||
|
||||
- name: Build documentation
|
||||
run: uv run zensical build
|
||||
|
||||
- name: Build webapp (simulator)
|
||||
run: uv run shinylive export webapp webapp-site
|
||||
|
||||
- name: Integrate webapp into docs
|
||||
run: |
|
||||
# Copy webapp into docs site at /simulator/
|
||||
mkdir -p site/simulator
|
||||
cp -r webapp-site/* site/simulator/
|
||||
echo "Webapp integrated at site/simulator/"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: ./site
|
||||
|
||||
deploy:
|
||||
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v5
|
||||
48
.github/workflows/markdown-code-runner.yml
vendored
48
.github/workflows/markdown-code-runner.yml
vendored
|
|
@ -1,48 +0,0 @@
|
|||
name: markdown-code-runner
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
markdown-code-runner:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
|
||||
ref: ${{ github.head_ref || github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.14.2"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v8.1.0
|
||||
|
||||
- name: Update generated content
|
||||
run: ./scripts/update-generated-content
|
||||
|
||||
- name: Check for changes
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
echo "::error::Auto-generated files are not up to date. Please run './scripts/update-generated-content' locally and push the changes."
|
||||
exit 1
|
||||
else
|
||||
echo "Changes detected, committing and pushing..."
|
||||
git add -u .
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git commit -m "Update auto-generated content"
|
||||
git pull --rebase
|
||||
git push
|
||||
fi
|
||||
else
|
||||
echo "No changes detected."
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue