Correct type for off delay in rfxtrx (#135994)
parent
4612f4da19
commit
568a27000d
|
@ -209,10 +209,7 @@ class RfxtrxOptionsFlow(OptionsFlow):
|
|||
except ValueError:
|
||||
errors[CONF_COMMAND_OFF] = "invalid_input_2262_off"
|
||||
|
||||
try:
|
||||
off_delay = none_or_int(user_input.get(CONF_OFF_DELAY), 10)
|
||||
except ValueError:
|
||||
errors[CONF_OFF_DELAY] = "invalid_input_off_delay"
|
||||
off_delay = user_input.get(CONF_OFF_DELAY)
|
||||
|
||||
if not errors:
|
||||
devices = {}
|
||||
|
@ -252,11 +249,11 @@ class RfxtrxOptionsFlow(OptionsFlow):
|
|||
vol.Optional(
|
||||
CONF_OFF_DELAY,
|
||||
description={"suggested_value": device_data[CONF_OFF_DELAY]},
|
||||
): str,
|
||||
): int,
|
||||
}
|
||||
else:
|
||||
off_delay_schema = {
|
||||
vol.Optional(CONF_OFF_DELAY): str,
|
||||
vol.Optional(CONF_OFF_DELAY): int,
|
||||
}
|
||||
data_schema.update(off_delay_schema)
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
"invalid_event_code": "Invalid event code",
|
||||
"invalid_input_2262_on": "Invalid input for command on",
|
||||
"invalid_input_2262_off": "Invalid input for command off",
|
||||
"invalid_input_off_delay": "Invalid input for off delay",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -726,7 +726,6 @@ async def test_options_add_and_configure_device(
|
|||
result["flow_id"],
|
||||
user_input={
|
||||
"data_bits": 4,
|
||||
"off_delay": "abcdef",
|
||||
"command_on": "xyz",
|
||||
"command_off": "xyz",
|
||||
},
|
||||
|
@ -735,7 +734,6 @@ async def test_options_add_and_configure_device(
|
|||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "set_device_options"
|
||||
assert result["errors"]
|
||||
assert result["errors"]["off_delay"] == "invalid_input_off_delay"
|
||||
assert result["errors"]["command_on"] == "invalid_input_2262_on"
|
||||
assert result["errors"]["command_off"] == "invalid_input_2262_off"
|
||||
|
||||
|
@ -745,7 +743,7 @@ async def test_options_add_and_configure_device(
|
|||
"data_bits": 4,
|
||||
"command_on": "0xE",
|
||||
"command_off": "0x7",
|
||||
"off_delay": "9",
|
||||
"off_delay": 9,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue