Skip to content

Commit

Permalink
Fix config data when values previously hold None (#1751)
Browse files Browse the repository at this point in the history
* Fix config data when values previously hold None

* linting issue

---------

Co-authored-by: Jozef Kruszynski <[email protected]>
  • Loading branch information
jozefKruszynski and Jozef Kruszynski authored Jan 3, 2024
1 parent 8146e20 commit b6f647f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/mass/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
ON_SUPERVISOR_SCHEMA = vol.Schema(
{
vol.Optional(CONF_USE_ADDON, default=True): bool,
vol.Optional(CONF_OPENAI_AGENT_ID, default=None): selector.ConversationAgentSelector(
vol.Optional(CONF_OPENAI_AGENT_ID, default=""): selector.ConversationAgentSelector(
selector.ConversationAgentSelectorConfig(language="en")
),
vol.Optional(CONF_ASSIST_AUTO_EXPOSE_PLAYERS, default=False): bool,
Expand All @@ -57,7 +57,7 @@ def get_manual_schema(user_input: dict[str, Any]) -> vol.Schema:
return vol.Schema(
{
vol.Required(CONF_URL, default=default_url): str,
vol.Optional(CONF_OPENAI_AGENT_ID, default=None): selector.ConversationAgentSelector(
vol.Optional(CONF_OPENAI_AGENT_ID, default=""): selector.ConversationAgentSelector(
selector.ConversationAgentSelectorConfig(language="en")
),
vol.Optional(CONF_ASSIST_AUTO_EXPOSE_PLAYERS, default=False): bool,
Expand All @@ -69,7 +69,7 @@ def get_zeroconf_schema() -> vol.Schema:
"""Return a schema for the zeroconf step."""
return vol.Schema(
{
vol.Optional(CONF_OPENAI_AGENT_ID, default=None): selector.ConversationAgentSelector(
vol.Optional(CONF_OPENAI_AGENT_ID, default=""): selector.ConversationAgentSelector(
selector.ConversationAgentSelectorConfig(language="en")
),
vol.Optional(CONF_ASSIST_AUTO_EXPOSE_PLAYERS, default=False): bool,
Expand Down Expand Up @@ -398,7 +398,9 @@ def mass_config_option_schema(self, config_entry: config_entries.ConfigEntry) ->
),
vol.Optional(
CONF_ASSIST_AUTO_EXPOSE_PLAYERS,
default=config_entry.data.get(CONF_ASSIST_AUTO_EXPOSE_PLAYERS),
default=config_entry.data.get(CONF_ASSIST_AUTO_EXPOSE_PLAYERS)
if config_entry.data.get(CONF_ASSIST_AUTO_EXPOSE_PLAYERS) is not None
else False,
): bool,
}

Expand Down

0 comments on commit b6f647f

Please sign in to comment.