Changed last seen to datetime to improve DB size usage #203

This commit is contained in:
Tomaae 2022-05-26 10:00:02 +02:00
parent 6b6a240412
commit 263b38b301
No known key found for this signature in database
GPG key ID: 8360BBD8A381D1C0

View file

@ -145,14 +145,3 @@ class MikrotikHostDeviceTracker(MikrotikDeviceTracker):
def state(self) -> str:
"""Return the state of the device."""
return self._ctrl.option_zone if self.is_connected else STATE_NOT_HOME
@property
def extra_state_attributes(self) -> Mapping[str, Any]:
"""Return the state attributes."""
attributes = super().extra_state_attributes
if self._data["last-seen"]:
attributes[format_attribute("last-seen")] = get_age(self._data["last-seen"])
else:
attributes[format_attribute("last-seen")] = "unknown"
return attributes