From 13cfd60019e897266cf2c3aa7a69be62f1020439 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 16 Jan 2023 11:36:21 +0100 Subject: [PATCH] Allow None in add_suggested_values_to_schema (#85763) --- homeassistant/data_entry_flow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 7072e52bdc0..59f76d90da8 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -457,7 +457,7 @@ class FlowHandler: return self.context.get("show_advanced_options", False) def add_suggested_values_to_schema( - self, data_schema: vol.Schema, suggested_values: Mapping[str, Any] + self, data_schema: vol.Schema, suggested_values: Mapping[str, Any] | None ) -> vol.Schema: """Make a copy of the schema, populated with suggested values. @@ -477,7 +477,11 @@ class FlowHandler: continue new_key = key - if key in suggested_values and isinstance(key, vol.Marker): + if ( + suggested_values + and key in suggested_values + and isinstance(key, vol.Marker) + ): # Copy the marker to not modify the flow schema new_key = copy.copy(key) new_key.description = {"suggested_value": suggested_values[key]}