Commit 174617c
authored
Harvest enum values from controllable definitions and fixtures, fix generation docs (#2085)
## Summary
While reviewing the enum-generation documentation, I found the generator
was leaving real data on the table and the docs describing it were
partly wrong. This PR fixes both.
### 1. Harvest `OverkizCommandParam` from controllable definitions
`extract_state_values_from_servers` only read `OverkizCommandParam`
values from `protocols.*.states[].enumValues`, missing:
- ~1600 `DiscreteState` `values` arrays in `controllableDefinitions`
- `enumValues` on command parameters in the protocols section
This adds **313 previously-missing parameter values** (e.g. `A_B_C`,
`AUTO_FAN`, `MAINS_SINGLE_PHASE`).
Two safety details:
- Purely numeric values (`"1"`–`"9"`) can't be valid Python identifiers
— now skipped and reported in the run output instead of emitting broken
code.
- Two verbatim API values contain Cyrillic characters (`pусский`,
`yкраїнськийon` from the Atlantic server) — `RUF001` added to the
generated file's `noqa` header.
### 2. Merge UI enum values from setup fixtures
`state.py` and `command.py` already merged
`tests/fixtures/setup/*.json`, but `ui.py` and `ui_profile.py` did not.
They now do, capturing real devices whose UI values the reference
endpoints of our available servers don't expose. Adds the `Startable`
and `StatefulStartable` profiles and lets three previously hardcoded
widgets come from real data.
`protocol.py` stays metadata-only — Protocol members need the full
`id`/`prefix`/`name`/`label`, which fixtures don't carry.
### 3. Fix `docs/development-utils.md`
The `generate_enums.py` "Generates" table omitted `state.py` entirely,
listed an incomplete source for `command.py`, and didn't reflect
fixtures as a source for the UI enums. Corrected and expanded.
## Test plan
- [x] `uv run utils/generate_enums.py` regenerates cleanly
- [x] `ruff`, `mypy`, `ty` pass
- [x] 456 tests pass1 parent c80be27 commit 174617c
5 files changed
Lines changed: 419 additions & 23 deletions
File tree
- docs
- pyoverkiz/enums
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
835 | 839 | | |
836 | 840 | | |
837 | 841 | | |
| |||
1767 | 1771 | | |
1768 | 1772 | | |
1769 | 1773 | | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
1770 | 1778 | | |
1771 | 1779 | | |
1772 | 1780 | | |
| |||
0 commit comments