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

Fix malformed user input error on MJPEG config flow #108058

Merged
merged 1 commit into from Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/mjpeg/config_flow.py
Expand Up @@ -54,7 +54,7 @@ def async_get_schema(

if show_name:
schema = {
vol.Optional(CONF_NAME, default=defaults.get(CONF_NAME)): str,
vol.Required(CONF_NAME, default=defaults.get(CONF_NAME)): str,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we fix the default instead so that it's never None?

Also, we should not use dict.get on line 157 since we know that the key will exist in the dict.

Copy link
Contributor Author

@codyc1515 codyc1515 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. This change was the simplest way I could see to "fix" the issue without risking breaking something else.

I don't understand why the name is ever asked for, which is the real reason this issue ever existed. It's asked once on setup then can never be configured again.

To be honest, I also don’t understand why the MJPEG variant of Generic Camera exists at all - shouldn't MJPEG cameras simply work in the Generic Camera?

**schema,
}

Expand Down