Skip to content

Commit cc0bad0

Browse files
ReneNulschDEclaude
andcommitted
fix: restore window position for the intermediate airing status
The Windowstatus enum has six values, not four. Comparing the Mercedes Android app 1.71 against the proto sources showed that the window covers only knew 0 to 3: 0 INTERMEDIATE, 1 COMPLETELY_OPENED, 2 COMPLETELY_CLOSED, 3 AIRING_POSITION, 4 INTERMEDIATE_AIRING_POSITION, 5 RUNNING WindowStatusOverall likewise has a fifth value, 4 RUNNING. Value 4 used to map to position 50 through the old WINDOW_STATUS_INTERMEDIATE set. The rewrite in #427 dropped it, so a window in the intermediate airing position reported no position at all. Restore the previous mapping. RUNNING stays deliberately unmapped: it means the window is moving and carries no direction, so any position would be a guess. That is now documented instead of being an accident of a missing dict key. Neither value appears in 121504 recorded websocket messages, so this closes a latent gap rather than an observed failure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 35ea5f8 commit cc0bad0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

custom_components/mbapi2020/cover.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,17 @@
2626
from .helper import LogHelper as loghelper
2727

2828
# Positions for the individual windows, based on the proto enum Windowstatus:
29-
# 0 INTERMEDIATE, 1 COMPLETELY_OPENED, 2 COMPLETELY_CLOSED, 3 AIRING_POSITION
30-
WINDOW_STATUS_POSITIONS: dict[int, int] = {0: 50, 1: 100, 2: 0, 3: 10}
29+
# 0 INTERMEDIATE, 1 COMPLETELY_OPENED, 2 COMPLETELY_CLOSED, 3 AIRING_POSITION,
30+
# 4 INTERMEDIATE_AIRING_POSITION, 5 RUNNING
31+
# RUNNING is deliberately absent: it means the window is moving and carries no
32+
# direction, so any position would be a guess. The entity reports unknown until
33+
# the car sends the status it settled on.
34+
WINDOW_STATUS_POSITIONS: dict[int, int] = {0: 50, 1: 100, 2: 0, 3: 10, 4: 50}
3135

3236
# Positions for the window summary, based on the proto enum WindowStatusOverall:
33-
# 0 OPEN, 1 CLOSED, 2 COMPLETELY_OPEN, 3 AIRING
34-
# Note the numbering differs from the individual windows above
37+
# 0 OPEN, 1 CLOSED, 2 COMPLETELY_OPEN, 3 AIRING, 4 RUNNING
38+
# Note the numbering differs from the individual windows above, and RUNNING is
39+
# absent here for the same reason
3540
WINDOW_STATUS_OVERALL_POSITIONS: dict[int, int] = {0: 50, 1: 0, 2: 100, 3: 10}
3641

3742
# Retrieval status values that indicate the car did not report a usable value

0 commit comments

Comments
 (0)