mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Fix creating onvif pull point subscriptions when InitialTerminationTime is required (#91470)
* Fix creating onvif pull point subscriptions when InitialTerminationTime is required fixes #85902 * Bump again because I got it wrong the first time.. this is why retest is good
This commit is contained in:
parent
89b1d5bb68
commit
b06d624d43
@ -32,6 +32,15 @@ def _stringify_onvif_error(error: Exception) -> str:
|
|||||||
return str(error)
|
return str(error)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_next_termination_time() -> str:
|
||||||
|
"""Get next termination time."""
|
||||||
|
return (
|
||||||
|
(dt_util.utcnow() + dt.timedelta(days=1))
|
||||||
|
.isoformat(timespec="seconds")
|
||||||
|
.replace("+00:00", "Z")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class EventManager:
|
class EventManager:
|
||||||
"""ONVIF Event Manager."""
|
"""ONVIF Event Manager."""
|
||||||
|
|
||||||
@ -84,7 +93,9 @@ class EventManager:
|
|||||||
|
|
||||||
async def async_start(self) -> bool:
|
async def async_start(self) -> bool:
|
||||||
"""Start polling events."""
|
"""Start polling events."""
|
||||||
if not await self.device.create_pullpoint_subscription():
|
if not await self.device.create_pullpoint_subscription(
|
||||||
|
{"InitialTerminationTime": _get_next_termination_time()}
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Create subscription manager
|
# Create subscription manager
|
||||||
@ -171,16 +182,11 @@ class EventManager:
|
|||||||
if not self._subscription:
|
if not self._subscription:
|
||||||
return
|
return
|
||||||
|
|
||||||
termination_time = (
|
|
||||||
(dt_util.utcnow() + dt.timedelta(days=1))
|
|
||||||
.isoformat(timespec="seconds")
|
|
||||||
.replace("+00:00", "Z")
|
|
||||||
)
|
|
||||||
with suppress(*SUBSCRIPTION_ERRORS):
|
with suppress(*SUBSCRIPTION_ERRORS):
|
||||||
# The first time we renew, we may get a Fault error so we
|
# The first time we renew, we may get a Fault error so we
|
||||||
# suppress it. The subscription will be restarted in
|
# suppress it. The subscription will be restarted in
|
||||||
# async_restart later.
|
# async_restart later.
|
||||||
await self._subscription.Renew(termination_time)
|
await self._subscription.Renew(_get_next_termination_time())
|
||||||
|
|
||||||
def async_schedule_pull(self) -> None:
|
def async_schedule_pull(self) -> None:
|
||||||
"""Schedule async_pull_messages to run."""
|
"""Schedule async_pull_messages to run."""
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/onvif",
|
"documentation": "https://www.home-assistant.io/integrations/onvif",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["onvif", "wsdiscovery", "zeep"],
|
"loggers": ["onvif", "wsdiscovery", "zeep"],
|
||||||
"requirements": ["onvif-zeep-async==1.2.5", "WSDiscovery==2.0.0"]
|
"requirements": ["onvif-zeep-async==1.2.7", "WSDiscovery==2.0.0"]
|
||||||
}
|
}
|
||||||
|
@ -1260,7 +1260,7 @@ ondilo==0.2.0
|
|||||||
onkyo-eiscp==1.2.7
|
onkyo-eiscp==1.2.7
|
||||||
|
|
||||||
# homeassistant.components.onvif
|
# homeassistant.components.onvif
|
||||||
onvif-zeep-async==1.2.5
|
onvif-zeep-async==1.2.7
|
||||||
|
|
||||||
# homeassistant.components.opengarage
|
# homeassistant.components.opengarage
|
||||||
open-garage==0.2.0
|
open-garage==0.2.0
|
||||||
|
@ -938,7 +938,7 @@ omnilogic==0.4.5
|
|||||||
ondilo==0.2.0
|
ondilo==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.onvif
|
# homeassistant.components.onvif
|
||||||
onvif-zeep-async==1.2.5
|
onvif-zeep-async==1.2.7
|
||||||
|
|
||||||
# homeassistant.components.opengarage
|
# homeassistant.components.opengarage
|
||||||
open-garage==0.2.0
|
open-garage==0.2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user