From 30c9a70dbf46ae534b0c394936904d626b632ff4 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Wed, 24 Jan 2024 19:47:07 +0100 Subject: [PATCH] Fix google_assistant climate modes might be None (#108793) --- homeassistant/components/google_assistant/trait.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 9b8a95f0b4a..189d1354e26 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -1152,12 +1152,12 @@ class TemperatureSettingTrait(_Trait): modes = [] attrs = self.state.attributes - for mode in attrs.get(climate.ATTR_HVAC_MODES, []): + for mode in attrs.get(climate.ATTR_HVAC_MODES) or []: google_mode = self.hvac_to_google.get(mode) if google_mode and google_mode not in modes: modes.append(google_mode) - for preset in attrs.get(climate.ATTR_PRESET_MODES, []): + for preset in attrs.get(climate.ATTR_PRESET_MODES) or []: google_mode = self.preset_to_google.get(preset) if google_mode and google_mode not in modes: modes.append(google_mode) @@ -2094,9 +2094,10 @@ class InputSelectorTrait(_Trait): def sync_attributes(self): """Return mode attributes for a sync request.""" attrs = self.state.attributes + sourcelist: list[str] = attrs.get(media_player.ATTR_INPUT_SOURCE_LIST) or [] inputs = [ {"key": source, "names": [{"name_synonym": [source], "lang": "en"}]} - for source in attrs.get(media_player.ATTR_INPUT_SOURCE_LIST, []) + for source in sourcelist ] payload = {"availableInputs": inputs, "orderedInputs": True}