Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions custom_components/myhome/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MyhomeFlowHandler(ConfigFlow, domain=DOMAIN):
@callback
def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return MyhomeOptionsFlowHandler(config_entry)
return MyhomeOptionsFlowHandler()

def __init__(self):
"""Initialize the MyHome flow."""
Expand Down Expand Up @@ -374,20 +374,24 @@ async def async_step_ssdp(self, discovery_info):
class MyhomeOptionsFlowHandler(OptionsFlow):
"""Handle MyHome options."""

def __init__(self, config_entry):
def __init__(self):
"""Initialize MyHome options flow."""
self.config_entry = config_entry
self.options = dict(config_entry.options)
self.data = dict(config_entry.data)
self.options = {}
self.data = {}

async def async_step_init(self, user_input=None): # pylint: disable=unused-argument
"""Manage the MyHome options."""
if not self.options:
self.options = dict(self.config_entry.options)
if not self.data:
self.data = dict(self.config_entry.data)
if CONF_WORKER_COUNT not in self.options:
self.options[CONF_WORKER_COUNT] = 1
if CONF_FILE_PATH not in self.options:
self.options[CONF_FILE_PATH] = "/config/myhome.yaml"
if CONF_GENERATE_EVENTS not in self.options:
self.options[CONF_GENERATE_EVENTS] = False

async def async_step_init(self, user_input=None): # pylint: disable=unused-argument
"""Manage the MyHome options."""

return await self.async_step_user()

async def async_step_user(self, user_input=None, errors={}): # pylint: disable=dangerous-default-value
Expand Down Expand Up @@ -447,3 +451,4 @@ async def async_step_user(self, user_input=None, errors={}): # pylint: disable=
),
errors=errors,
)