瀏覽代碼

event: add debug logging.

User reports that after previous update, no events are generated.
Try to find why.

Issue #1818
Jason Rumney 1 年之前
父節點
當前提交
81dcf3dd59
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      custom_components/tuya_local/event.py

+ 17 - 0
custom_components/tuya_local/event.py

@@ -63,7 +63,19 @@ class TuyaLocalEvent(TuyaLocalEntity, EventEntity):
                 # filter out full polls pulling the current ongoing value,
                 # filter out full polls pulling the current ongoing value,
                 # but limit this to allow repeats to come through on non-full polls
                 # but limit this to allow repeats to come through on non-full polls
                 if value == self.last_value and dps["full_poll"]:
                 if value == self.last_value and dps["full_poll"]:
+                    _LOGGER.debug(
+                        "%s/%s value %s is the same as last value, ignoring",
+                        self._config._device.config,
+                        self.name or "event",
+                        value,
+                    )
                     return
                     return
+                _LOGGER.debug(
+                    "%s/%s triggering event for value %s",
+                    self._config._device.config,
+                    self.name or "event",
+                    value,
+                )
                 self._last_value = value
                 self._last_value = value
                 self._trigger_event(
                 self._trigger_event(
                     value,
                     value,
@@ -72,4 +84,9 @@ class TuyaLocalEvent(TuyaLocalEntity, EventEntity):
             # clear out the remembered value when a full poll comes through
             # clear out the remembered value when a full poll comes through
             # with nothing
             # with nothing
             elif value is None and dps["full_poll"]:
             elif value is None and dps["full_poll"]:
+                _LOGGER.debug(
+                    "%s/%s clearing last value due to no value in full poll",
+                    self._config._device.config,
+                    self.name or "event",
+                )
                 self._last_value = None
                 self._last_value = None