Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct type for off delay in rfxtrx #135994

Merged
merged 2 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions homeassistant/components/rfxtrx/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ async def async_step_set_device_options(
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 = {}
Expand Down Expand Up @@ -252,11 +249,11 @@ async def async_step_set_device_options(
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)

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/rfxtrx/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
}
},
Expand Down
4 changes: 1 addition & 3 deletions tests/components/rfxtrx/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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"

Expand All @@ -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,
},
)

Expand Down