Просмотр исходного кода

device: output warning when a protocol error is recevied

This is already done in the receive loop, but errors were not detected
when doing a one time refresh (as in the Test connection when a device
is added - when those messages are perhaps most valuable).

Issue #1609
Jason Rumney 2 лет назад
Родитель
Сommit
2dbd30b12b
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      custom_components/tuya_local/device.py

+ 7 - 0
custom_components/tuya_local/device.py

@@ -427,6 +427,13 @@ class TuyaLocalDevice(object):
             self.name,
             log_json(new_state),
         )
+        if "Err" in new_state:
+            _LOGGER.warning(
+                "%s protocol error %s: %s",
+                self.name,
+                new_state.get("Err"),
+                new_state.get("Error", "message not provided"),
+            )
         _LOGGER.debug(
             "new state (incl pending): %s",
             log_json(self._get_cached_state()),