mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
update login script and drastically reduce chattiness of debug logs for setups with a lot of subscriptions
This commit is contained in:
@@ -58,10 +58,13 @@ async def main():
|
|||||||
login_result = await mc.wait_for_event(EventType.LOGIN_SUCCESS, filter, timeout=10)
|
login_result = await mc.wait_for_event(EventType.LOGIN_SUCCESS, filter, timeout=10)
|
||||||
print(f"Login result: {login_result}")
|
print(f"Login result: {login_result}")
|
||||||
|
|
||||||
|
send_ver = await mc.commands.send_cmd(repeater, "ver")
|
||||||
# Wait a bit for the login response
|
if send_ver.type == EventType.ERROR:
|
||||||
print("Waiting for login events...")
|
print(f"Error sending version command: {send_ver.payload}")
|
||||||
await asyncio.sleep(3)
|
return
|
||||||
|
await mc.wait_for_event(EventType.MESSAGES_WAITING)
|
||||||
|
ver_msg = await mc.commands.get_msg()
|
||||||
|
print(f"Version message: {ver_msg.payload}")
|
||||||
|
|
||||||
# Send status request
|
# Send status request
|
||||||
print("Sending status request...")
|
print("Sending status request...")
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ class EventDispatcher:
|
|||||||
event = await self.queue.get()
|
event = await self.queue.get()
|
||||||
logger.debug(f"Dispatching event: {event.type}, {event.payload}, {event.attributes}")
|
logger.debug(f"Dispatching event: {event.type}, {event.payload}, {event.attributes}")
|
||||||
for subscription in self.subscriptions.copy():
|
for subscription in self.subscriptions.copy():
|
||||||
logger.debug(f"Checking subscription: {subscription.event_type}, {subscription.attribute_filters}")
|
|
||||||
# Check if event type matches
|
# Check if event type matches
|
||||||
if subscription.event_type is None or subscription.event_type == event.type:
|
if subscription.event_type is None or subscription.event_type == event.type:
|
||||||
# Check if all attribute filters match
|
# Check if all attribute filters match
|
||||||
|
|||||||
Reference in New Issue
Block a user