catch TypeError's in addition to ValueError's for unifi direct device tracker (#19994)

* catch TypeError's in addition to ValueError's in response from unifi access point

sometimes unifi's access point returns incomplete json which results in a TypeError because ssid_table is None

* fix syntax error
This commit is contained in:
Thomas Delaet 2019-01-12 05:44:16 +01:00 committed by Paulus Schoutsen
parent 418fa226e6
commit 2208563de4

View File

@ -131,6 +131,6 @@ def _response_to_json(response):
active_clients[client.get("mac")] = client
return active_clients
except ValueError:
except (ValueError, TypeError):
_LOGGER.error("Failed to decode response from AP.")
return {}