mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Correct type for off delay in rfxtrx (#135994)
This commit is contained in:
parent
4612f4da19
commit
568a27000d
@ -209,10 +209,7 @@ class RfxtrxOptionsFlow(OptionsFlow):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
errors[CONF_COMMAND_OFF] = "invalid_input_2262_off"
|
errors[CONF_COMMAND_OFF] = "invalid_input_2262_off"
|
||||||
|
|
||||||
try:
|
off_delay = user_input.get(CONF_OFF_DELAY)
|
||||||
off_delay = none_or_int(user_input.get(CONF_OFF_DELAY), 10)
|
|
||||||
except ValueError:
|
|
||||||
errors[CONF_OFF_DELAY] = "invalid_input_off_delay"
|
|
||||||
|
|
||||||
if not errors:
|
if not errors:
|
||||||
devices = {}
|
devices = {}
|
||||||
@ -252,11 +249,11 @@ class RfxtrxOptionsFlow(OptionsFlow):
|
|||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_OFF_DELAY,
|
CONF_OFF_DELAY,
|
||||||
description={"suggested_value": device_data[CONF_OFF_DELAY]},
|
description={"suggested_value": device_data[CONF_OFF_DELAY]},
|
||||||
): str,
|
): int,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
off_delay_schema = {
|
off_delay_schema = {
|
||||||
vol.Optional(CONF_OFF_DELAY): str,
|
vol.Optional(CONF_OFF_DELAY): int,
|
||||||
}
|
}
|
||||||
data_schema.update(off_delay_schema)
|
data_schema.update(off_delay_schema)
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
"invalid_event_code": "Invalid event code",
|
"invalid_event_code": "Invalid event code",
|
||||||
"invalid_input_2262_on": "Invalid input for command on",
|
"invalid_input_2262_on": "Invalid input for command on",
|
||||||
"invalid_input_2262_off": "Invalid input for command off",
|
"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%]"
|
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -726,7 +726,6 @@ async def test_options_add_and_configure_device(
|
|||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input={
|
user_input={
|
||||||
"data_bits": 4,
|
"data_bits": 4,
|
||||||
"off_delay": "abcdef",
|
|
||||||
"command_on": "xyz",
|
"command_on": "xyz",
|
||||||
"command_off": "xyz",
|
"command_off": "xyz",
|
||||||
},
|
},
|
||||||
@ -735,7 +734,6 @@ async def test_options_add_and_configure_device(
|
|||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "set_device_options"
|
assert result["step_id"] == "set_device_options"
|
||||||
assert result["errors"]
|
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_on"] == "invalid_input_2262_on"
|
||||||
assert result["errors"]["command_off"] == "invalid_input_2262_off"
|
assert result["errors"]["command_off"] == "invalid_input_2262_off"
|
||||||
|
|
||||||
@ -745,7 +743,7 @@ async def test_options_add_and_configure_device(
|
|||||||
"data_bits": 4,
|
"data_bits": 4,
|
||||||
"command_on": "0xE",
|
"command_on": "0xE",
|
||||||
"command_off": "0x7",
|
"command_off": "0x7",
|
||||||
"off_delay": "9",
|
"off_delay": 9,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user