Skip to content

Commit

Permalink
Prevent KeyError when Matter device sends invalid value for StartUpOn…
Browse files Browse the repository at this point in the history
…Off (#124280)
  • Loading branch information
marcelveldt committed Aug 25, 2024
1 parent f06c21c commit 51b520d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/matter/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ def _update_from_device(self) -> None:
entity_category=EntityCategory.CONFIG,
translation_key="startup_on_off",
options=["On", "Off", "Toggle", "Previous"],
measurement_to_ha=lambda x: {
measurement_to_ha=lambda x: { # pylint: disable=unnecessary-lambda
0: "Off",
1: "On",
2: "Toggle",
None: "Previous",
}[x],
}.get(x),
ha_to_native_value=lambda x: {
"Off": 0,
"On": 1,
Expand Down

0 comments on commit 51b520d

Please sign in to comment.