Skip to content

Commit 4d78d1a

Browse files
authored
Fix OverkizCommandParam STANDARD/HISTORICAL/ERROR/UNHEALTHY casing regression (#2126)
Follow-up to #2096. ## Problem Four more `OverkizCommandParam` members were regressed from their lowercase API state values to capitalized variants in #2085 — the same bug class as `ON`/`OFF`/`UNKNOWN`/`BATTERY` (fixed in #2096): | Member | Was | Now | Real lowercase source | |--------|-----|-----|-----------------------| | `STANDARD` | `"Standard"` | `"standard"` | `io:MemorizedSimpleVolumeState`, `io:VentilationConfigurationModeState`, `modbus:DHWModeState`, `modbus:YutakiDHWVirtualOperatingModeState` | | `HISTORICAL` | `"Historical"` | `"historical"` | (Linky pair of `STANDARD`) | | `ERROR` | `"Error"` | `"error"` | `core:UpdateStatusState` | | `UNHEALTHY` | `"Unhealthy"` | `"unhealthy"` | `core:AirQualityIndexLevelState` | The real Overkiz API returns these **state** values in lowercase, so every equality comparison against these members silently fails — breaking downstream consumers such as Home Assistant's `overkiz` integration (e.g. DHW/ventilation state maps keyed on `OverkizCommandParam.STANDARD`). ## Root cause The capitalized values were harvested from *other* states that emit the same word in different casing (`zigbee:LinkyModeState` → `"Standard"`/`"Historical"`, `netatmo:HealthIndexState` → `"Error"`/`"Unhealthy"`). Both casings are real API values, but they collapse to one `SCREAMING_SNAKE` enum name. The generator's alphabetical sort (codepoint order, capitals first) let the capitalized catalog value claim the name and drop the lowercase value consumers depend on — exactly the mechanism described in #2096. ## Fix 1. Restore the four values to lowercase in `pyoverkiz/enums/command.py`. The generator's existing "preserve established value on a name collision" guard now pins them on regeneration. 2. Extend the #2093 regression test (`TestOverkizCommandParamApiValues`) to pin all four. ## Notes / follow-up - `FAIR`/`POOR` were intentionally **left** as `"Fair"`/`"Poor"` — those casings are the only values `netatmo:HealthIndexState` emits; no lowercase variant exists in the API. - The capitalized variants (`zigbee:LinkyModeState` `"Standard"`/`"Historical"`, `netatmo:HealthIndexState` `"Error"`/`"Unhealthy"`) are **dropped for now**. They're real state values the single-name enum structurally can't represent alongside the lowercase ones. Keeping both would require an explicit alias map in the generator (e.g. `STANDARD_LINKY = "Standard"`) plus a hard failure on unhandled collisions — tracked as a separate change. ## Verification - `uv run utils/generate_enums.py` is idempotent — all four values stay lowercase after regeneration (`+0 new` params). - `uv run pytest tests/test_enums.py` — 10 passed.
1 parent 2bfa37f commit 4d78d1a

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

pyoverkiz/enums/command.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ class OverkizCommandParam(StrEnum):
16811681
ENERGYHEAT = "energyheat"
16821682
ENERGY_DEMAND_STATUS = "energyDemandStatus"
16831683
ENVIRONMENT_PROTECTION = "environmentProtection"
1684-
ERROR = "Error"
1684+
ERROR = "error"
16851685
ERROR_ABORT = "error-abort"
16861686
ERROR_DEFAULT_INITIAL_CONDITION = "error-default-initial-condition"
16871687
ERROR_INVALID_IMAGE = "error-invalid-image"
@@ -1771,7 +1771,7 @@ class OverkizCommandParam(StrEnum):
17711771
HIGH = "high"
17721772
HIGHEST = "highest"
17731773
HIGH_DEMAND = "high demand" # value with space
1774-
HISTORICAL = "Historical"
1774+
HISTORICAL = "historical"
17751775
HI_FAN = "Hi FAN" # value with space
17761776
HOLIDAYS = "holidays"
17771777
HOME = "home"
@@ -2048,7 +2048,7 @@ class OverkizCommandParam(StrEnum):
20482048
SMOOTH = "smooth"
20492049
SNAPSHOT = "snapshot"
20502050
SOS = "sos"
2051-
STANDARD = "Standard"
2051+
STANDARD = "standard"
20522052
STANDARD_SHUTTER = "standardShutter"
20532053
STANDARD_SHUTTER_OPP = "standardShutterOpp"
20542054
STANDBY = "standby"
@@ -2089,7 +2089,7 @@ class OverkizCommandParam(StrEnum):
20892089
UNAVAILABLE = "unavailable"
20902090
UNDEPLOYED = "undeployed"
20912091
UNDETECTED = "undetected"
2092-
UNHEALTHY = "Unhealthy"
2092+
UNHEALTHY = "unhealthy"
20932093
UNHEALTHY_ERROR = "Unhealthy, Error" # value with space
20942094
UNHEALTHY_FOR_SENSITIVE_GROUPS = "unhealthyForSensitiveGroups"
20952095
UNINSTALLED = "uninstalled"

tests/test_enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@ def test_lowercase_state_values(self):
9898
assert OverkizCommandParam.OFF == "off"
9999
assert OverkizCommandParam.UNKNOWN == "unknown"
100100
assert OverkizCommandParam.BATTERY == "battery"
101+
assert OverkizCommandParam.STANDARD == "standard"
102+
assert OverkizCommandParam.HISTORICAL == "historical"
103+
assert OverkizCommandParam.ERROR == "error"
104+
assert OverkizCommandParam.UNHEALTHY == "unhealthy"

0 commit comments

Comments
 (0)