Handle invalid datetime in onvif (#136014)

pull/136002/head^2
J. Nick Koston 2025-01-19 09:16:40 -10:00 committed by GitHub
parent 568a27000d
commit 3a078d5414
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 10 deletions

View File

@ -263,16 +263,22 @@ class ONVIFDevice:
LOGGER.warning("%s: Could not retrieve date/time on this camera", self.name)
return
cam_date = dt.datetime(
cdate.Date.Year,
cdate.Date.Month,
cdate.Date.Day,
cdate.Time.Hour,
cdate.Time.Minute,
cdate.Time.Second,
0,
tzone,
)
try:
cam_date = dt.datetime(
cdate.Date.Year,
cdate.Date.Month,
cdate.Date.Day,
cdate.Time.Hour,
cdate.Time.Minute,
cdate.Time.Second,
0,
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)