Skip to content

Commit c306177

Browse files
authored
Update config_flow.py
1 parent d323e07 commit c306177

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

custom_components/apsystems_ecu_proxy/config_flow.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from homeassistant import config_entries, exceptions
55
from homeassistant.core import callback
66

7-
from .const import DOMAIN
7+
from .const import DOMAIN, KEYS
88

99
_LOGGER = logging.getLogger(__name__)
1010

@@ -25,11 +25,11 @@ async def async_step_user(self, user_input=None):
2525
"""First step: Initial set-up of integration options."""
2626
_LOGGER.debug("async_step_user")
2727
schema = vol.Schema({
28-
vol.Required("ema_host", default="3.67.1.32"): str,
29-
vol.Required("message_ignore_age", default="1800"): str,
30-
vol.Required("max_stub_interval", default="300"): str,
31-
vol.Required("no_update_timeout", default="600"): str,
32-
vol.Required("send_to_ema", default=True): bool,
28+
vol.Required(KEYS[0], default="3.67.1.32"): str,
29+
vol.Required(KEYS[1], default="1800"): str,
30+
vol.Required(KEYS[2], default="300"): str,
31+
vol.Required(KEYS[3], default="600"): str,
32+
vol.Required(KEYS[4], default=True): bool,
3333
})
3434

3535
if user_input is not None:
@@ -58,16 +58,9 @@ async def async_step_init(self, user_input=None):
5858
)
5959
_LOGGER.debug("async_step_init with options: %s", current_options)
6060

61-
keys = [
62-
"ema_host",
63-
"message_ignore_age",
64-
"max_stub_interval",
65-
"no_update_timeout",
66-
"send_to_ema"
67-
]
6861
schema = vol.Schema({
6962
vol.Required(key, default=current_options.get(key)): str if key != "send_to_ema" else bool
70-
for key in keys
63+
for key in KEYS
7164
})
7265

7366
if user_input is not None:

0 commit comments

Comments
 (0)