mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Prevent KeyError when Matter device sends invalid value for StartUpOnOff (#124280)
This commit is contained in:
parent
f06c21c8cc
commit
51b520db0c
@ -229,12 +229,12 @@ DISCOVERY_SCHEMAS = [
|
|||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
translation_key="startup_on_off",
|
translation_key="startup_on_off",
|
||||||
options=["On", "Off", "Toggle", "Previous"],
|
options=["On", "Off", "Toggle", "Previous"],
|
||||||
measurement_to_ha=lambda x: {
|
measurement_to_ha=lambda x: { # pylint: disable=unnecessary-lambda
|
||||||
0: "Off",
|
0: "Off",
|
||||||
1: "On",
|
1: "On",
|
||||||
2: "Toggle",
|
2: "Toggle",
|
||||||
None: "Previous",
|
None: "Previous",
|
||||||
}[x],
|
}.get(x),
|
||||||
ha_to_native_value=lambda x: {
|
ha_to_native_value=lambda x: {
|
||||||
"Off": 0,
|
"Off": 0,
|
||||||
"On": 1,
|
"On": 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user