Exclude AsusWRT tracker state attribute from recorder (#102602)
This commit is contained in:
parent
5d430f53cd
commit
5245c94342
1 changed files with 5 additions and 1 deletions
|
@ -10,6 +10,8 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from .const import DATA_ASUSWRT, DOMAIN
|
||||
from .router import AsusWrtDevInfo, AsusWrtRouter
|
||||
|
||||
ATTR_LAST_TIME_REACHABLE = "last_time_reachable"
|
||||
|
||||
DEFAULT_DEVICE_NAME = "Unknown device"
|
||||
|
||||
|
||||
|
@ -52,6 +54,8 @@ def add_entities(
|
|||
class AsusWrtDevice(ScannerEntity):
|
||||
"""Representation of a AsusWrt device."""
|
||||
|
||||
_unrecorded_attributes = frozenset({ATTR_LAST_TIME_REACHABLE})
|
||||
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(self, router: AsusWrtRouter, device: AsusWrtDevInfo) -> None:
|
||||
|
@ -97,7 +101,7 @@ class AsusWrtDevice(ScannerEntity):
|
|||
self._attr_extra_state_attributes = {}
|
||||
if self._device.last_activity:
|
||||
self._attr_extra_state_attributes[
|
||||
"last_time_reachable"
|
||||
ATTR_LAST_TIME_REACHABLE
|
||||
] = self._device.last_activity.isoformat(timespec="seconds")
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue