Skip to content

Fix Extend ONVIF unique ID with profile index#33103

Merged
balloob merged 1 commit intodevfrom
frenck-2020-0319
Mar 21, 2020
Merged

Fix Extend ONVIF unique ID with profile index#33103
balloob merged 1 commit intodevfrom
frenck-2020-0319

Conversation

@frenck
Copy link
Copy Markdown
Member

@frenck frenck commented Mar 21, 2020

Proposed change

In #32093 unique IDs for the ONVIF integration was added by me, however, I did not take into account an ONVIF capable device that can deliver multiple cameras (e.g., by a DVR or other aggregators).

This PR adjusts the unique ID to take the camera profile index into account. I've implemented it to use the hardware mac address when using profile 0 and hardware mac address + profile index otherwise. That will ensure it isn't a breaking change for current users.

I've tested it locally by adding a ONVIF capable test camera with multiple profiles.

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
camera:
  - platform: onvif
    name: my_camera
    host: 192.168.1.2
    port: 8000
    username: admin
    password: admin
  - platform: onvif
    name: my_camera
    host: 192.168.1.2
    port: 8000
    username: admin
    password: admin
    profile: 1

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 probot-home-assistant Bot added integration: onvif small-pr PRs with less than 30 lines. labels Mar 21, 2020
@frenck frenck added this to the 0.107.5 milestone Mar 21, 2020
@frenck frenck changed the title Extend ONVIF unique ID with profile index Fix Extend ONVIF unique ID with profile index Mar 21, 2020
@balloob balloob merged commit 5893f6b into dev Mar 21, 2020
@balloob balloob deleted the frenck-2020-0319 branch March 21, 2020 18:36
@balloob balloob mentioned this pull request Mar 21, 2020
@lock lock Bot locked and limited conversation to collaborators Mar 22, 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.

ONVIF Cameras with same IP but different profile treated as one entity

3 participants