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 ONVIF config entry unique ID #36008

Merged
merged 5 commits into from
May 24, 2020

Conversation

hunterjm
Copy link
Member

@hunterjm hunterjm commented May 23, 2020

Proposed change

Fixes issue where some ONVIF devices do not expose MAC address through the API. This falls back to the serial number as the config entry Unique ID, fixing #35883

While testing (adding and removing config entries after commenting out portions of code) I realized that the Event subscription is not ended properly when removing a config entry and will continue attempting to poll the device indefinitely until a Home Assistant reboot. A fix for that is also included in this PR.

While playing around in config flow, I also made password optional which fixes #35904

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

@hunterjm hunterjm added this to the 0.110.2 milestone May 23, 2020
@project-bot project-bot bot added this to Needs review in Dev May 23, 2020
@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev May 23, 2020
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.

For the future, please separate different fixes into different PRs. That will speed up review and time to merge.

homeassistant/components/onvif/base.py Show resolved Hide resolved
homeassistant/components/onvif/camera.py Show resolved Hide resolved
homeassistant/components/onvif/config_flow.py Show resolved Hide resolved
homeassistant/components/onvif/config_flow.py Outdated Show resolved Hide resolved
tests/components/onvif/test_config_flow.py Outdated Show resolved Hide resolved
Dev automation moved this from By Code Owner to Review in progress May 23, 2020
@hunterjm
Copy link
Member Author

hunterjm commented May 24, 2020

Will do RE more than one issue in this PR. The second issue really only changed the schema for one step changing a .Required to a .Optional, which is why it was included, and the event fix was isolated and 3 lines of code.

@frenck frenck modified the milestones: 0.110.2, 0.110.3 May 24, 2020
Dev automation moved this from Review in progress to Reviewer approved May 24, 2020
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 MartinHjelmare merged commit bd8848e into home-assistant:dev May 24, 2020
Dev automation moved this from Reviewer approved to Done May 24, 2020
@hunterjm hunterjm deleted the bugfix/onvif-unique-id branch May 25, 2020 00:53
frenck pushed a commit that referenced this pull request May 26, 2020
* fallback to device serial number if no mac available

* make password optional to fix #35904

* update tests to reflect new flow

* fix snake case and AsyncMock

* add comments around why weird things are being done
@frenck frenck mentioned this pull request May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Dev
  
Done
4 participants