Parcourir la source

Log warning if a OpenADR protocol error has been received

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen il y a 4 ans
Parent
commit
287a3a3111
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  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):