mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +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"
|
IDLE = "idle"
|
||||||
READY = "ready"
|
READY = "ready"
|
||||||
SLEEPING = "sleeping"
|
SLEEPING = "sleeping"
|
||||||
UNKNOWN = "unknown"
|
|
||||||
INVALID = "invalid"
|
|
||||||
|
|
||||||
|
|
||||||
_INVERTER_STATUS_CODES: Final[dict[int, InverterStatusCodeOption]] = {
|
_INVERTER_STATUS_CODES: Final[dict[int, InverterStatusCodeOption]] = {
|
||||||
@ -61,13 +59,13 @@ _INVERTER_STATUS_CODES: Final[dict[int, InverterStatusCodeOption]] = {
|
|||||||
11: InverterStatusCodeOption.IDLE,
|
11: InverterStatusCodeOption.IDLE,
|
||||||
12: InverterStatusCodeOption.READY,
|
12: InverterStatusCodeOption.READY,
|
||||||
13: InverterStatusCodeOption.SLEEPING,
|
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 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):
|
class MeterLocationCodeOption(StrEnum):
|
||||||
|
@ -86,9 +86,7 @@
|
|||||||
"error": "Error",
|
"error": "Error",
|
||||||
"idle": "Idle",
|
"idle": "Idle",
|
||||||
"ready": "Ready",
|
"ready": "Ready",
|
||||||
"sleeping": "Sleeping",
|
"sleeping": "Sleeping"
|
||||||
"unknown": "Unknown",
|
|
||||||
"invalid": "Invalid"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"led_state": {
|
"led_state": {
|
||||||
|
@ -560,8 +560,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -605,8 +603,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
@ -3815,8 +3811,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -3860,8 +3854,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
@ -7234,8 +7226,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -7279,8 +7269,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
@ -7949,8 +7937,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
@ -7994,8 +7980,6 @@
|
|||||||
'idle',
|
'idle',
|
||||||
'ready',
|
'ready',
|
||||||
'sleeping',
|
'sleeping',
|
||||||
'unknown',
|
|
||||||
'invalid',
|
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user