From 93899e981f7726f8e4f6d86afe8f578ef64afd20 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Tue, 27 Jul 2021 12:35:16 +0200 Subject: [PATCH] UniFi lies about the client being noted, using the real note instead if it exists (#53542) --- homeassistant/components/unifi/device_tracker.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/unifi/device_tracker.py b/homeassistant/components/unifi/device_tracker.py index 64963643447..faf51e6c853 100644 --- a/homeassistant/components/unifi/device_tracker.py +++ b/homeassistant/components/unifi/device_tracker.py @@ -38,7 +38,7 @@ CLIENT_CONNECTED_ATTRIBUTES = [ "ip", "is_11r", "is_guest", - "noted", + "note", "qos_policy_applied", "radio", "radio_proto", @@ -258,13 +258,11 @@ class UniFiClientTracker(UniFiClient, ScannerEntity): """Return the client state attributes.""" raw = self.client.raw + attributes_to_check = CLIENT_STATIC_ATTRIBUTES if self.is_connected: - attributes = { - k: raw[k] for k in CLIENT_CONNECTED_ALL_ATTRIBUTES if k in raw - } - else: - attributes = {k: raw[k] for k in CLIENT_STATIC_ATTRIBUTES if k in raw} + attributes_to_check = CLIENT_CONNECTED_ALL_ATTRIBUTES + attributes = {k: raw[k] for k in attributes_to_check if k in raw} attributes["is_wired"] = self.is_wired return attributes