From c6504ef1054ccd95d2728d66d6284a7f63a9c6ee Mon Sep 17 00:00:00 2001 From: tolwi Date: Thu, 14 Sep 2023 17:46:06 +0300 Subject: [PATCH] optional "name" in response["data"]["user"] (#145) --- custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py b/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py index 05aacdc..65b4d2f 100644 --- a/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py +++ b/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py @@ -54,7 +54,7 @@ def authorize(self): try: self.token = response["data"]["token"] self.user_id = response["data"]["user"]["userId"] - user_name = response["data"]["user"]["name"] + user_name = response["data"]["user"].get("name", "") except KeyError as key: raise EcoflowException(f"Failed to extract key {key} from response: {response}")