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 Franck Nijhof
parent 762f5a5d18
commit c90fa90faf
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

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,