Remove custom "unknown" state from Fronius Enum sensor (#133361)

This commit is contained in:
Matthias Alphart 2024-12-16 14:13:19 +01:00 committed by GitHub
parent a953abf5c3
commit 6f278fb856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 24 deletions

View File

@ -42,8 +42,6 @@ class InverterStatusCodeOption(StrEnum):
IDLE = "idle"
READY = "ready"
SLEEPING = "sleeping"
UNKNOWN = "unknown"
INVALID = "invalid"
_INVERTER_STATUS_CODES: Final[dict[int, InverterStatusCodeOption]] = {
@ -61,13 +59,13 @@ _INVERTER_STATUS_CODES: Final[dict[int, InverterStatusCodeOption]] = {
11: InverterStatusCodeOption.IDLE,
12: InverterStatusCodeOption.READY,
13: InverterStatusCodeOption.SLEEPING,
255: InverterStatusCodeOption.UNKNOWN,
# 255: "Unknown" is handled by `None` state - same as the invalid codes.
}
def get_inverter_status_message(code: StateType) -> InverterStatusCodeOption:
def get_inverter_status_message(code: StateType) -> InverterStatusCodeOption | None:
"""Return a status message for a given status code."""
return _INVERTER_STATUS_CODES.get(code, InverterStatusCodeOption.INVALID) # type: ignore[arg-type]
return _INVERTER_STATUS_CODES.get(code) # type: ignore[arg-type]
class MeterLocationCodeOption(StrEnum):

View File

@ -86,9 +86,7 @@
"error": "Error",
"idle": "Idle",
"ready": "Ready",
"sleeping": "Sleeping",
"unknown": "Unknown",
"invalid": "Invalid"
"sleeping": "Sleeping"
}
},
"led_state": {

View File

@ -560,8 +560,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'config_entry_id': <ANY>,
@ -605,8 +603,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'context': <ANY>,
@ -3815,8 +3811,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'config_entry_id': <ANY>,
@ -3860,8 +3854,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'context': <ANY>,
@ -7234,8 +7226,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'config_entry_id': <ANY>,
@ -7279,8 +7269,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'context': <ANY>,
@ -7949,8 +7937,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'config_entry_id': <ANY>,
@ -7994,8 +7980,6 @@
'idle',
'ready',
'sleeping',
'unknown',
'invalid',
]),
}),
'context': <ANY>,