From 3c085ae9bdd3171cd760d3d15e9f0d1117a44553 Mon Sep 17 00:00:00 2001 From: Christopher Hoch Date: Mon, 29 Apr 2024 15:12:45 +0200 Subject: [PATCH] more logging --- pyvlx/node.py | 2 ++ pyvlx/pyvlx.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyvlx/node.py b/pyvlx/node.py index 678a34a1..55e1eeff 100644 --- a/pyvlx/node.py +++ b/pyvlx/node.py @@ -9,6 +9,7 @@ from .api import SetNodeName from .exception import PyVLXException +from .log import PYVLXLOG if TYPE_CHECKING: from pyvlx import PyVLX @@ -37,6 +38,7 @@ def unregister_device_updated_cb(self, device_updated_cb: CallbackType) -> None: async def after_update(self) -> None: """Execute callbacks after internal state has been changed.""" + PYVLXLOG.debug("Node %r after update. Calling %d update listeners", self.node_id, len(self.device_updated_cbs)) for device_updated_cb in self.device_updated_cbs: # pylint: disable=not-callable self.pyvlx.loop.create_task(device_updated_cb(self)) # type: ignore diff --git a/pyvlx/pyvlx.py b/pyvlx/pyvlx.py index 15293e61..139af6e1 100644 --- a/pyvlx/pyvlx.py +++ b/pyvlx/pyvlx.py @@ -75,7 +75,7 @@ async def connect(self) -> None: PYVLXLOG.debug("Connecting to KLF 200 was opened") for node in self.nodes: - await self.loop.create_task(node.after_update()) + await node.after_update() async def reboot_gateway(self) -> None: """For Compatibility: Reboot the KLF 200.""" @@ -126,4 +126,4 @@ async def on_connection_closed_cb(self) -> None: """Handle KLF 200 closed connection callback.""" PYVLXLOG.debug("Connecting to KLF 200 was closed") for node in self.nodes: - await self.loop.create_task(node.after_update()) + await node.after_update()