Skip to content

Commit

Permalink
Fix missing ONVIF events when switching from PullPoint to webhooks
Browse files Browse the repository at this point in the history
We now let the PullPoint subscription expire instead of explicitly
unsubscribing when pausing the subscription. We will still unsubscribe
it if Home Assistant is shutdown or the integration is reloaded

Some cameras will cancel ALL subscriptions when we do an unsubscribe
so we want to let the PullPoint subscription expire instead
of explicitly cancelling it.
  • Loading branch information
bdraco committed May 5, 2023
1 parent c8c1466 commit 6af9e30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion homeassistant/components/onvif/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ def async_pause(self) -> None:
"""Pause pullpoint subscription."""
LOGGER.debug("%s: Pausing PullPoint manager", self._name)
self.state = PullPointManagerState.PAUSED
self._hass.async_create_task(self._async_cancel_and_unsubscribe())
# Cancel the renew job so we don't renew the subscription
# and stop pulling messages.
self._async_cancel_pullpoint_renew()
self.async_cancel_pull_messages()
# We do not unsubscribe from the pullpoint subscription and instead
# let the subscription expire since some cameras will terminate all
# subscriptions if we unsubscribe which will break the webhook.

@callback
def async_resume(self) -> None:
Expand Down

0 comments on commit 6af9e30

Please sign in to comment.