Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Make sure timestamp is real date
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Dec 14, 2021
1 parent 318aafe commit 80d6126
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.util.dt import parse_datetime
from nibeuplink.typing import CategoryType, ParameterId, SystemUnit

from . import NibeData, NibeSystem
Expand Down Expand Up @@ -284,7 +285,7 @@ class NibeSystemSensorEntityDescription(SensorEntityDescription):
name="last activity",
device_class=DEVICE_CLASS_TIMESTAMP,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
state_fn=lambda x: x.system["lastActivityDate"],
state_fn=lambda x: parse_datetime(x.system["lastActivityDate"]),
),
NibeSystemSensorEntityDescription(
key="connectionStatus",
Expand Down

0 comments on commit 80d6126

Please sign in to comment.