diff --git a/homeassistant/components/matter/select.py b/homeassistant/components/matter/select.py index d91953610e9..1bba18b2c5b 100644 --- a/homeassistant/components/matter/select.py +++ b/homeassistant/components/matter/select.py @@ -105,7 +105,7 @@ class MatterModeSelectEntity(MatterSelectEntity): ) modes = {mode.mode: mode.label for mode in cluster.supportedModes} self._attr_options = list(modes.values()) - self._attr_current_option = modes[cluster.currentMode] + self._attr_current_option = modes.get(cluster.currentMode) # handle optional Description attribute as descriptive name for the mode if desc := getattr(cluster, "description", None): self._attr_name = desc diff --git a/tests/components/matter/test_select.py b/tests/components/matter/test_select.py index bda2a933d42..27ce6d32c22 100644 --- a/tests/components/matter/test_select.py +++ b/tests/components/matter/test_select.py @@ -97,8 +97,8 @@ async def test_attribute_select_entities( await trigger_subscription_callback(hass, matter_client) state = hass.states.get(entity_id) assert state.state == "on" - # test that an invalid value (e.g. 255) leads to an unknown state - set_node_attribute(light_node, 1, 6, 16387, 255) + # test that an invalid value (e.g. 253) leads to an unknown state + set_node_attribute(light_node, 1, 6, 16387, 253) await trigger_subscription_callback(hass, matter_client) state = hass.states.get(entity_id) assert state.state == "unknown"