UniFi - Use state to know if device is online (#25876)
This commit is contained in:
1 parent
b8460bb331
commit
ab7db5fbd0
5 files changed
+13
-8
No files matched your search
@@ -294,7 +294,7 @@ class UniFiDeviceTracker(ScannerEntity):
|
||||
CONF_DETECTION_TIME, DEFAULT_DETECTION_TIME
|
||||
)
|
||||
|
||||
if self.device.last_seen and (
|
||||
if self.device.state == 1 and (
|
||||
dt_util.utcnow() - dt_util.utc_from_timestamp(float(self.device.last_seen))
|
||||
< detection_time
|
||||
):
|
||||
@@ -339,15 +339,18 @@ class UniFiDeviceTracker(ScannerEntity):
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
if not self.device.last_seen:
|
||||
if self.device.state == 0:
|
||||
return {}
|
||||
|
||||
attributes = {}
|
||||
|
||||
attributes["upgradable"] = self.device.upgradable
|
||||
attributes["overheating"] = self.device.overheating
|
||||
|
||||
if self.device.has_fan:
|
||||
attributes["fan_level"] = self.device.fan_level
|
||||
|
||||
if self.device.overheating:
|
||||
attributes["overheating"] = self.device.overheating
|
||||
|
||||
if self.device.upgradable:
|
||||
attributes["upgradable"] = self.device.upgradable
|
||||
|
||||
return attributes
|
||||
Reference in new issue
Block a user