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

Add Speedtestdotnet config_flow #36254

Merged
merged 14 commits into from
Jun 10, 2020

Conversation

engrbm87
Copy link
Contributor

@engrbm87 engrbm87 commented May 29, 2020

Breaking change

Integration is now configured through the UI. To successfully import from configuration.yaml please remove monitored_conditions. If server_id is mentioned it will checked against the list of servers before importing.

Proposed change

  • Configure Speedtestdotnet through UI.
  • Select test server from list or choose "*Auto Detect" option
  • Set scan interval in minutes (Default = 60 minutes)
  • Choose option to disable auto update (manual)
  • Service to run speed test

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

Example entry for configuration.yaml:

# Example configuration.yaml

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

@probot-home-assistant
Copy link

Hey there @rohankapoorcom, mind taking a look at this pull request as its been labeled with a integration (speedtestdotnet) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@MartinHjelmare MartinHjelmare changed the title Speedtestdotnet integration with config_flow support Add Speedtestdotnet config_flow May 29, 2020
homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_init.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_init.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_sensor.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_sensor.py Outdated Show resolved Hide resolved
@MartinHjelmare
Copy link
Member

We need to register a listener for the config entry and have a callback change the update interval on the coordinator.

https://developers.home-assistant.io/docs/config_entries_options_flow_handler#signal-updates

Copy link
Member

@rohankapoorcom rohankapoorcom left a comment

Choose a reason for hiding this comment

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

Hey @engrbm87 - thanks for putting the work in to convert this to a config flow. I've been wanting to do it myself, but have other things take priority over much of open source contributions!

I'm glad to have to join as a code owner for the integration, but I would appreciate not being removed from it.

Thanks again for your contribution. I haven't formally reviewed all of it, but overall, it looks good to me.

@engrbm87
Copy link
Contributor Author

engrbm87 commented Jun 5, 2020

Hey @engrbm87 - thanks for putting the work in to convert this to a config flow. I've been wanting to do it myself, but have other things take priority over much of open source contributions!

I'm glad to have to join as a code owner for the integration, but I would appreciate not being removed from it.

Thanks again for your contribution. I haven't formally reviewed all of it, but overall, it looks good to me.

Hello @rohankapoorcom , sorry for removing your name by mistake. I will sure add it now.

homeassistant/components/speedtestdotnet/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/const.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/speedtestdotnet/sensor.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_sensor.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_sensor.py Outdated Show resolved Hide resolved
tests/components/speedtestdotnet/test_init.py Outdated Show resolved Hide resolved
Copy link
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.

Great!

@MartinHjelmare
Copy link
Member

Could we try to import the config yaml to a config entry to ease the transition for users?

@engrbm87
Copy link
Contributor Author

engrbm87 commented Jun 5, 2020

Could we try to import the config yaml to a config entry to ease the transition for users?

Currently the config yaml includes monitored_conditions which will not be used anymore. So the user will need to update the config yaml entry.
Also the server_id is parameter is no longer required as the user can choose from a list in the UI or choose the Auto Detect option. Importing the server_id means we need to verify that the value is valid.

@MartinHjelmare
Copy link
Member

I'm thinking we just import the server_id and validate that against available ids. If good, create the entry, if not good, abort.

@engrbm87
Copy link
Contributor Author

engrbm87 commented Jun 5, 2020

Ok, let me work on that.

@frenck

This comment has been minimized.

Copy link
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.

Nice!

Copy link
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.

Sorry, one comment more.

@MartinHjelmare
Copy link
Member

Please update the breaking change paragraph and mention what options from the config yaml will be imported.

@MartinHjelmare
Copy link
Member

Are we ready to merge?

@MartinHjelmare MartinHjelmare merged commit 2c1a76c into home-assistant:dev Jun 10, 2020
@rohankapoorcom
Copy link
Member

Woo-hoo! Nice work @engrbm87!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants