diff --git a/custom_components/mikrotik_router/config_flow.py b/custom_components/mikrotik_router/config_flow.py index 149c72a..a03b4ae 100644 --- a/custom_components/mikrotik_router/config_flow.py +++ b/custom_components/mikrotik_router/config_flow.py @@ -149,16 +149,16 @@ class MikrotikControllerOptionsFlowHandler(OptionsFlow): async def async_step_init(self, user_input=None): """Manage the options.""" - return await self.async_step_device_tracker(user_input) + return await self.async_step_basic_options(user_input) - async def async_step_device_tracker(self, user_input=None): - """Manage the device tracker options.""" + async def async_step_basic_options(self, user_input=None): + """Manage the basic options options.""" if user_input is not None: self.options.update(user_input) - return self.async_create_entry(title="", data=self.options) + return await self.async_step_device_tracker() return self.async_show_form( - step_id="device_tracker", + step_id="basic_options", data_schema=vol.Schema( { vol.Optional( @@ -179,6 +179,20 @@ class MikrotikControllerOptionsFlowHandler(OptionsFlow): CONF_TRACK_IFACE_CLIENTS, DEFAULT_TRACK_IFACE_CLIENTS ), ): bool, + } + ), + ) + + async def async_step_device_tracker(self, user_input=None): + """Manage the device tracker options.""" + if user_input is not None: + self.options.update(user_input) + return self.async_create_entry(title="", data=self.options) + + return self.async_show_form( + step_id="device_tracker", + data_schema=vol.Schema( + { vol.Optional( CONF_TRACK_HOSTS, default=self.config_entry.options.get( diff --git a/custom_components/mikrotik_router/strings.json b/custom_components/mikrotik_router/strings.json index e89dc3a..0796c87 100644 --- a/custom_components/mikrotik_router/strings.json +++ b/custom_components/mikrotik_router/strings.json @@ -1,41 +1,43 @@ { "config": { - "title": "Mikrotik Router", + "error": { + "cannot_connect": "Cannot connect to Mikrotik.", + "connection_timeout": "Mikrotik connection timeout.", + "name_exists": "Name already exists.", + "ssl_handshake_failure": "SSL handshake failure", + "wrong_login": "Invalid user name or password." + }, "step": { "user": { - "title": "Mikrotik Router", - "description": "Set up Mikrotik Router integration.", "data": { - "name": "Name of the integration", "host": "Host", - "port": "Port", - "username": "Username", + "name": "Name of the integration", "password": "Password", - "ssl": "Use SSL" - } + "port": "Port", + "ssl": "Use SSL", + "username": "Username" + }, + "description": "Set up Mikrotik Router integration.", + "title": "Mikrotik Router" } - }, - "error": { - "name_exists": "Name already exists.", - "cannot_connect": "Cannot connect to Mikrotik.", - "ssl_handshake_failure": "SSL handshake failure", - "connection_timeout": "Mikrotik connection timeout.", - "wrong_login": "Invalid user name or password." } }, "options": { "step": { - "init": { - "data": {} - }, - "device_tracker": { + "basic_options": { "data": { "scan_interval": "Scan interval (requires HA restart)", "track_iface_clients": "Show client MAC and IP on interfaces", - "unit_of_measurement": "Unit of measurement", + "unit_of_measurement": "Unit of measurement" + }, + "title": "Basic options" + }, + "device_tracker": { + "data": { "track_network_hosts": "Track network devices", "track_network_hosts_timeout": "Track network devices timeout (seconds)" - } + }, + "title": "Device tracking options" } } }