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 nina integration #56647

Merged
merged 19 commits into from
Dec 5, 2021
Merged

Add nina integration #56647

merged 19 commits into from
Dec 5, 2021

Conversation

DeerMaximum
Copy link
Contributor

@DeerMaximum DeerMaximum commented Sep 25, 2021

Breaking change

Proposed change

This pull request added the support to retrieve warnings from the German NINA app.

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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

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

To help with the load of incoming pull requests:

Copy link
Contributor

@austinmroczek austinmroczek left a comment

Choose a reason for hiding this comment

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

Thanks for the submission. There are a few items to be fixed, and some lint errors to be corrected.

homeassistant/components/nina/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@austinmroczek austinmroczek left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. You'll need to fix the lint errors before this gets merged. I know it's a matter of style, but conforming helps keep the entire code base looking similar.

@DeerMaximum
Copy link
Contributor Author

The remaining errors are generated by the black git hook. I have tried to fix them, but the changes are always reverted.

.coveragerc Outdated Show resolved Hide resolved
Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

I have added some review comments.

Also, here are some more general thoughts:

  1. This is not really user friendly, can we change this somehow?

image

  1. The config flow is really slow and not very responsive, selecting something causes the browser to freeze for at least 3 seconds until anything happens.
  2. You are creating entities based on user input, you should take care of the edge cases.

Feel free to tag me again once you have implemented the feedback accordingly or if you have any follow up questions.

homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/translations/de.json Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

@DeerMaximum
Copy link
Contributor Author

@marvin-w I have now split the city selection into 6 dropdown menus. So there is only a short lag when opening. Would this be a suitable option?
Unbenannt

@marvin-w
Copy link
Contributor

I don't see any new commits, but it looks better

Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Looks better, added some new review comments.

Please fix the pylint errors instead of ignoring them.

homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
tests/components/nina/test_binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
@marvin-w
Copy link
Contributor

@DeerMaximum Please make sure you are following our developer guidelines in our developer documentation.

https://developers.home-assistant.io/

Install the pre-commit hook locally in order to avoid formatting issues or make sure to run those checks manually before pushing.

homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/nina/binary_sensor.py Outdated Show resolved Hide resolved
tests/components/nina/test_binary_sensor.py Show resolved Hide resolved
tests/fixtures/nina/sample_warnings.json Outdated Show resolved Hide resolved
@marvin-w
Copy link
Contributor

Left some comments, please fix the cla-error

Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Hey :)

I tested it again and it looks much better, I added some more comments to primarily the config flow which I think needs some cleaning.

Feel free to request a review so that I don't forget to have another look.

Thanks!

homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/translations/en.json Outdated Show resolved Hide resolved
tests/components/nina/test_init.py Outdated Show resolved Hide resolved
tests/components/nina/test_config_flow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Thanks! Looks better already! Just some minor comments.

homeassistant/components/nina/const.py Outdated Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/nina/const.py Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for the fast integration!

After retesting I found out that if the Corona Filter is active it will still "block" the space for those entities and move the relevant warnings to the entity under it.

image

I'd have expected 1 and 2 to be used instead of 3 and 4 - can you please have a look again?

So 1 and 2 should be Unsafe and not 3 and 4. Can we change this?

Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de>
Copy link
Contributor

@marvin-w marvin-w left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @DeerMaximum!

Tested locally and working nicely. Code looks good. Documentation is available. Brands PR is created.

I've asked in discord if one more pair of eyes can give it a quick look.

@marvin-w marvin-w merged commit 9f7b8d3 into home-assistant:dev Dec 5, 2021
@marvin-w
Copy link
Contributor

marvin-w commented Dec 5, 2021

Thanks @DeerMaximum!

@DeerMaximum DeerMaximum deleted the nina branch December 5, 2021 14:12
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2021
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.

Please address the comments in a new PR. Thanks!

homeassistant/components/nina/__init__.py Show resolved Hide resolved
homeassistant/components/nina/__init__.py Show resolved Hide resolved
homeassistant/components/nina/__init__.py Show resolved Hide resolved
homeassistant/components/nina/__init__.py Show resolved Hide resolved
homeassistant/components/nina/config_flow.py Show resolved Hide resolved
{
**{
vol.Optional(region): cv.multi_select(self.regions[region])
for region in CONST_REGIONS
Copy link
Member

Choose a reason for hiding this comment

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

This is a weird form. Why are we splitting it in different region groups? Why not just have one field for all regions?

Copy link
Member

Choose a reason for hiding this comment

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

If this was done to solve browser performance, it seems we're working around an issue instead of solving it.

Copy link
Contributor

@marvin-w marvin-w Dec 15, 2021

Choose a reason for hiding this comment

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

If I remember correctly the reason was browser performance: #56647 (review)

Should I open an issue for it instead? There are a lot of possible inputs here and it will definitely lag if this is done in a single field.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we should find out why there's lag.

tests/components/nina/test_binary_sensor.py Show resolved Hide resolved
tests/components/nina/test_config_flow.py Show resolved Hide resolved
tests/components/nina/test_config_flow.py Show resolved Hide resolved
@home-assistant home-assistant unlocked this conversation Dec 13, 2021
@home-assistant home-assistant deleted a comment from homeassistant Dec 13, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2021
@DeerMaximum DeerMaximum mentioned this pull request Dec 15, 2021
22 tasks
@home-assistant home-assistant unlocked this conversation Dec 16, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2021
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.

6 participants