mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Remove custom "unknown" state from Fronius Enum sensor (#133361)
This commit is contained in:
parent
a953abf5c3
commit
6f278fb856
@ -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):
|
||||
|
@ -86,9 +86,7 @@
|
||||
"error": "Error",
|
||||
"idle": "Idle",
|
||||
"ready": "Ready",
|
||||
"sleeping": "Sleeping",
|
||||
"unknown": "Unknown",
|
||||
"invalid": "Invalid"
|
||||
"sleeping": "Sleeping"
|
||||
}
|
||||
},
|
||||
"led_state": {
|
||||
|
@ -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>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user