mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Handle invalid datetime in onvif (#136014)
This commit is contained in:
parent
b1445e5926
commit
5d1e2d17da
@ -263,6 +263,7 @@ class ONVIFDevice:
|
|||||||
LOGGER.warning("%s: Could not retrieve date/time on this camera", self.name)
|
LOGGER.warning("%s: Could not retrieve date/time on this camera", self.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
cam_date = dt.datetime(
|
cam_date = dt.datetime(
|
||||||
cdate.Date.Year,
|
cdate.Date.Year,
|
||||||
cdate.Date.Month,
|
cdate.Date.Month,
|
||||||
@ -273,6 +274,11 @@ class ONVIFDevice:
|
|||||||
0,
|
0,
|
||||||
tzone,
|
tzone,
|
||||||
)
|
)
|
||||||
|
except ValueError as err:
|
||||||
|
LOGGER.warning(
|
||||||
|
"%s: Could not parse date/time from camera: %s", self.name, err
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
cam_date_utc = cam_date.astimezone(dt_util.UTC)
|
cam_date_utc = cam_date.astimezone(dt_util.UTC)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user