mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
fix for timestamp not present in SIA (#53015)
This commit is contained in:
parent
49d109a969
commit
7e16d38fc8
@ -6,6 +6,8 @@ from typing import Any
|
|||||||
|
|
||||||
from pysiaalarm import SIAEvent
|
from pysiaalarm import SIAEvent
|
||||||
|
|
||||||
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from .const import ATTR_CODE, ATTR_ID, ATTR_MESSAGE, ATTR_TIMESTAMP, ATTR_ZONE
|
from .const import ATTR_CODE, ATTR_ID, ATTR_MESSAGE, ATTR_TIMESTAMP, ATTR_ZONE
|
||||||
|
|
||||||
PING_INTERVAL_MARGIN = 30
|
PING_INTERVAL_MARGIN = 30
|
||||||
@ -42,7 +44,9 @@ def get_event_data_from_sia_event(event: SIAEvent) -> dict[str, Any]:
|
|||||||
"code": event.code,
|
"code": event.code,
|
||||||
"message": event.message,
|
"message": event.message,
|
||||||
"x_data": event.x_data,
|
"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_qualifier": event.event_qualifier,
|
||||||
"event_type": event.event_type,
|
"event_type": event.event_type,
|
||||||
"partition": event.partition,
|
"partition": event.partition,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user