Skip to content

Commit

Permalink
Improve config flow dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhbjsh committed Nov 1, 2024
1 parent bd7f39a commit b0d37af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions custom_components/ssh/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.device_registry import format_mac
from homeassistant.helpers.selector import (
BooleanSelector,
ObjectSelector,
SelectOptionDict,
SelectSelector,
Expand Down Expand Up @@ -361,15 +362,11 @@ async def async_step_init(
vol.Required(
CONF_ALLOW_TURN_OFF,
default=self._data[CONF_ALLOW_TURN_OFF],
): bool,
): BooleanSelector(),
vol.Required(
CONF_DISCONNECT_MODE,
default=self._data[CONF_DISCONNECT_MODE],
): bool,
vol.Required(
CONF_RESET_COMMANDS,
default=False,
): bool,
): BooleanSelector(),
vol.Required(
CONF_UPDATE_INTERVAL,
default=self._data[CONF_UPDATE_INTERVAL],
Expand All @@ -386,6 +383,10 @@ async def async_step_init(
CONF_SENSOR_COMMANDS,
default=self._data[CONF_SENSOR_COMMANDS],
): ListSelector(SENSOR_COMMAND_SCHEMA),
vol.Required(
CONF_RESET_COMMANDS,
default=False,
): BooleanSelector(),
}
),
)
Expand All @@ -411,11 +412,11 @@ async def async_step_reset_commands(
vol.Required(
CONF_RESET_DEFAULT_COMMANDS,
default=True,
): bool,
): BooleanSelector(),
vol.Required(
CONF_REMOVE_CUSTOM_COMMANDS,
default=False,
): bool,
): BooleanSelector(),
}
),
)
Expand Down Expand Up @@ -633,13 +634,13 @@ async def async_step_user(
default=self._data.get(
CONF_ADD_HOST_KEYS, DEFAULT_ADD_HOST_KEYS
),
): bool,
): BooleanSelector(),
vol.Required(
CONF_LOAD_SYSTEM_HOST_KEYS,
default=self._data.get(
CONF_LOAD_SYSTEM_HOST_KEYS, DEFAULT_LOAD_SYSTEM_HOST_KEYS
),
): bool,
): BooleanSelector(),
}
),
)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/ssh/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
"data": {
"allow_turn_off": "Allow to turn the device off",
"disconnect_mode": "Disconnect between commands (experimental)",
"reset_commands": "Reset commands",
"update_interval": "Update interval",
"command_timeout": "Command timeout",
"action_commands": "Action commands",
"sensor_commands": "Sensor commands"
"sensor_commands": "Sensor commands",
"reset_commands": "Reset commands"
}
},
"reset_commands": {
Expand Down

0 comments on commit b0d37af

Please sign in to comment.