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

Restore ONVIF sensors #70393

Merged
merged 4 commits into from
Apr 27, 2022
Merged

Conversation

hunterjm
Copy link
Member

Proposed change

Add ability to restore sensors to ONVIF. On startup we pull data from the camera, but some states do not get returned until they change. This allows us to continue creating entities that were previously seen on the device and restore the last known state until it changes again.

This also fixes a bug introduced in #69708 where the sensor states were never updated.

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:

@hunterjm hunterjm requested a review from davet2001 April 22, 2022 00:42
@MartinHjelmare MartinHjelmare changed the title ONVIF: Restore Sensors Restore ONVIF sensors Apr 22, 2022
Copy link
Contributor

@davet2001 davet2001 left a comment

Choose a reason for hiding this comment

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

Minor comments (mostly questions that I couldn't be sure either way)

homeassistant/components/onvif/binary_sensor.py Outdated Show resolved Hide resolved
homeassistant/components/onvif/event.py Show resolved Hide resolved
homeassistant/components/onvif/sensor.py Show resolved Hide resolved
homeassistant/components/onvif/sensor.py Outdated Show resolved Hide resolved
@hunterjm
Copy link
Member Author

Minor comments (mostly questions that I couldn't be sure either way)

Hoepfully resolved/answered your comments/questions.

Copy link
Contributor

@davet2001 davet2001 left a comment

Choose a reason for hiding this comment

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

From my point of view, this looks ok now, but probably would benefit from a 2nd review by someone else.

@hunterjm hunterjm added second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. smash Indicator this PR is close to finish for merging or closing labels Apr 26, 2022
@balloob
Copy link
Member

balloob commented Apr 27, 2022

I removed the usage of hass.helpers because we're phasing it out (doesn't support typing) and replaced async_get_registry with async_get which is a callback.

@balloob balloob merged commit 29a2df3 into home-assistant:dev Apr 27, 2022
@balloob balloob removed the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Apr 27, 2022
@hunterjm hunterjm deleted the onvif-restore-sensors branch April 27, 2022 12:28
@github-actions github-actions bot locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix by-code-owner cla-signed integration: onvif smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants