Skip to content

Commit

Permalink
Update config_flow.py
Browse files Browse the repository at this point in the history
Fetch existing values for a config when editing it from the UI.
  • Loading branch information
sayam93 authored Dec 20, 2024
1 parent 77ce872 commit 0fc0479
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions custom_components/whatspie/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ async def async_step_init(self, user_input=None):
# Update entry with new options
return self.async_create_entry(title="", data=user_input)

# Fetch current values from options
api_token = self.config_entry.options.get(
CONF_API_TOKEN, self.config_entry.data.get(CONF_API_TOKEN)
)
from_number = self.config_entry.options.get(
CONF_FROM_NUMBER, self.config_entry.data.get(CONF_FROM_NUMBER)
)
country_code = self.config_entry.options.get(
CONF_COUNTRY_CODE, self.config_entry.data.get(CONF_COUNTRY_CODE)
)

options_schema = vol.Schema(
{
vol.Required(
Expand Down

0 comments on commit 0fc0479

Please sign in to comment.