Skip to content

Commit 4b9e0ca

Browse files
fix: show human-readable status labels in CLI device tables
format_device_status() was interpolating the raw Status enum value (e.g. "update_available") straight into Rich markup instead of a readable label, unlike every other column in the same table. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VApHaH9KZ6BPV9SwvUAVLH
1 parent b55f917 commit 4b9e0ca

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

packages/cli/src/cli/presentation/styles.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,27 @@ def get_device_status_style(status: str) -> str:
100100
return status_styles.get(str(status).lower(), Colors.DEVICE_UNKNOWN)
101101

102102

103+
_STATUS_LABELS = {
104+
"detected": "Detected",
105+
"updated": "Updated",
106+
"update_available": "Update Available",
107+
"no_update_needed": "Up to Date",
108+
"auth_required": "Auth Required",
109+
"not_shelly": "Not a Shelly Device",
110+
"unreachable": "Unreachable",
111+
"error": "Error",
112+
}
113+
114+
115+
def get_device_status_label(status: str) -> str:
116+
key = status.value if hasattr(status, "value") else str(status)
117+
label = _STATUS_LABELS.get(key.lower())
118+
if label is not None:
119+
return label
120+
return key.replace("_", " ").title() if key else "Unknown"
121+
122+
103123
def format_device_status(status: str) -> str:
104124
style = get_device_status_style(status)
105-
return f"[{style}]{status}[/{style}]"
125+
label = get_device_status_label(status)
126+
return f"[{style}]{label}[/{style}]"

0 commit comments

Comments
 (0)