fix for timestamp not present in SIA (#53015)

This commit is contained in:
Eduard van Valkenburg 2021-07-14 20:01:16 +02:00 committed by GitHub
parent 49d109a969
commit 7e16d38fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@ from typing import Any
from pysiaalarm import SIAEvent
from homeassistant.util.dt import utcnow
from .const import ATTR_CODE, ATTR_ID, ATTR_MESSAGE, ATTR_TIMESTAMP, ATTR_ZONE
PING_INTERVAL_MARGIN = 30
@ -42,7 +44,9 @@ def get_event_data_from_sia_event(event: SIAEvent) -> dict[str, Any]:
"code": event.code,
"message": event.message,
"x_data": event.x_data,
"timestamp": event.timestamp.isoformat(),
"timestamp": event.timestamp.isoformat()
if event.timestamp
else utcnow().isoformat(),
"event_qualifier": event.event_qualifier,
"event_type": event.event_type,
"partition": event.partition,