소스 검색

Log warning if a OpenADR protocol error has been received

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 년 전
부모
커밋
287a3a3111
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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):