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

Conversation

codyc1515
Copy link
Contributor

Proposed change

Name is required for the config flow but doesn't make it mandatory - this change does - which fixes error "User input malformed: expected str for dictionary value @ data['name']".

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • I have followed the [perfect PR recommendations][perfect-pr]
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

Fixes error "User input malformed: expected str for dictionary value @ data['name']" when no name was specified in the config entry
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @codyc1515 👍

../Frenck

@frenck frenck merged commit 5cc1a76 into home-assistant:dev Jan 15, 2024
53 checks passed
@codyc1515 codyc1515 deleted the mjpeg-config-name branch January 15, 2024 09:03
@@ -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?

@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants