Selaa lähdekoodia

Log warning if a OpenADR protocol error has been received

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 vuotta sitten
vanhempi
commit
287a3a3111
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      openleadr/client.py

+ 4 - 0
openleadr/client.py

@@ -690,6 +690,10 @@ class OpenADRClient:
         except Exception as err:
             logger.error(f"The incoming message could not be parsed or validated: {err}")
             return None, {}
+        if message_payload['response']['response_code'] != 200:
+            logger.warning("We got a non-OK OpenADR response from the server: "
+                           f"{message_payload['response']['response_code']}: "
+                           f"{message_payload['response']['response_description']}")
         return message_type, message_payload
 
     async def _on_event(self, message):