Fix google_assistant climate modes might be None (#108793)
parent
eeafb61b8f
commit
12126ebfda
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue