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 cameras that cannot parse relative time #92711

Merged
merged 25 commits into from
May 14, 2023
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented May 7, 2023

Proposed change

The spec requires that the camera can parse relative or absolute timestamps However there are many cameras that cannot parse time correctly.

Much of the event code has been offloaded to the library as support to determine if the camera has broken time and switch to absolute timestamps is now built into the library

We want to try relative times first as they are less prone to issues where ha time and camera time are not in sync

Additionally the webhook url has been shortened because the long url causes some camera to crash

changelog: openvideolibs/python-onvif-zeep-async@v2.1.1...v3.1.7

This is working great and its all bug fixes but there is a lot of refactoring here to make this work so I tested each of the 51 test cameras with this change-set.

We are making progress for sure as ONVIF jumped on analytics to 8,139 (4.2%) for 2023.5.x edit: (now 8,609 (4.5%)) edit: (now 9,096 (4.7%)) so I assume a lot more people are having successes (but we usually don't hear about those)

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)
  • Deprecation (breaking change to happen in the future)
  • 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
  • I have followed the perfect PR recommendations
  • 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.

To help with the load of incoming pull requests:

The spec requires that the camera can parse relative or absolute timestamps
However there are many cameras that cannot parse time correctly.

Much of the event code has been offloaded to the library and
support to determine if the camera has broken time and switch
to absolute timestamps is now built into the library
@home-assistant
Copy link

home-assistant bot commented May 7, 2023

Hey there @hunterjm, mind taking a look at this pull request as it has been labeled with an integration (onvif) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of onvif can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign onvif Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@bdraco bdraco closed this May 7, 2023
@bdraco bdraco reopened this May 7, 2023
@bdraco
Copy link
Member Author

bdraco commented May 7, 2023

This is working great and its all bug fixes but there is a lot of refactoring here so I'm still doing a lot of manual testing.

@bdraco bdraco added this to the 2023.5.3 milestone May 7, 2023
@bdraco
Copy link
Member Author

bdraco commented May 7, 2023

down to 8 more cameras to test ...

@bdraco
Copy link
Member Author

bdraco commented May 7, 2023

thats all the cameras. found a small race in the webhook setup that is now fixed as well so I'll need to start testing over....

@bdraco
Copy link
Member Author

bdraco commented May 7, 2023

Looks like I'm not going to have time to finish a full retest before I'm traveling so this will have to wait a week until I get back and can finish testing.

@bdraco bdraco removed this from the 2023.5.3 milestone May 7, 2023
@bdraco bdraco closed this May 9, 2023
@bdraco bdraco reopened this May 9, 2023
@bdraco
Copy link
Member Author

bdraco commented May 14, 2023

Retest with the original 42 cameras + the 9 more that showed up while I was traveling looks good.

@bdraco bdraco added this to the 2023.5.3 milestone May 14, 2023
@bdraco bdraco marked this pull request as ready for review May 14, 2023 19:07
@bdraco bdraco requested a review from hunterjm as a code owner May 14, 2023 19:07
@balloob balloob modified the milestones: 2023.5.3, 2023.5.4 May 14, 2023
@balloob balloob merged commit ef887e5 into dev May 14, 2023
@balloob balloob deleted the onvif_relative_time_fix branch May 14, 2023 20:08
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.