Skip to content

Use suggestd_value instead of default in Monoprice options flow#35107

Merged
MartinHjelmare merged 1 commit intohome-assistant:devfrom
OnFreund:monoprice_suggested_value
May 3, 2020
Merged

Use suggestd_value instead of default in Monoprice options flow#35107
MartinHjelmare merged 1 commit intohome-assistant:devfrom
OnFreund:monoprice_suggested_value

Conversation

@OnFreund
Copy link
Copy Markdown
Contributor

@OnFreund OnFreund commented May 3, 2020

Proposed change

Use suggested value (instead of default) for source names, so they can be easily removed in the options flow.
See home-assistant/frontend#5603 for more detail on the use of suggested values and the differences compared to default values.

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Are we depending on the frontend version where this is available?

It's good to give some context when using new features of the frontend like linking to the frontend PR:
home-assistant/frontend#5603

if str(index) in previous_sources:
key = vol.Optional(source, default=previous_sources[str(index)])
key = vol.Optional(
source, description={"suggested_value": previous_sources[str(index)]}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Has suggested_value been documented in our developer docs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It hasn't. I couldn't find any place where the use of schema for config flows was documented at all, so didn't really know where to put this.
More than happy to update the docs to reflect this if there's a relevant place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@OnFreund
Copy link
Copy Markdown
Contributor Author

OnFreund commented May 3, 2020

Thanks. I updated the description to link to the relevant PR.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare
Copy link
Copy Markdown
Member

Has the frontend version where this is available been released?

@OnFreund
Copy link
Copy Markdown
Contributor Author

OnFreund commented May 3, 2020

Not yet. It can still work with the current version (which will just ignore the suggested value), but will not have source names pre-filled.

@MartinHjelmare MartinHjelmare merged commit 90fbb15 into home-assistant:dev May 3, 2020
@OnFreund OnFreund deleted the monoprice_suggested_value branch May 3, 2020 13:44
@lock lock Bot locked and limited conversation to collaborators May 6, 2020
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.

3 participants