mdeweerd / zha-toolkit

🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
GNU General Public License v3.0
171 stars 17 forks source link

zdo_scan_now: Unable to serialize to JSON #198

Closed galmok closed 10 months ago

galmok commented 10 months ago

I was calling zdo_scan_now (takes no arguments) and it errors with a JSON serialization error:

2023-08-16 18:53:05.334 INFO (MainThread) [custom_components.zha_toolkit] Running ZHA Toolkit service: <ServiceCall zha_toolkit.zdo_scan_now (c:01H7ZM7QNN0YFJNBQYXXXXXXXX)>
2023-08-16 18:53:05.353 DEBUG (MainThread) [custom_components.zha_toolkit] module is <module 'custom_components.zha_toolkit' from '/config/custom_components/zha_toolkit/__init__.py'>
2023-08-16 18:53:05.357 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Parameters '{}'
2023-08-16 18:53:05.358 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Final manf 'None'
2023-08-16 18:53:05.359 DEBUG (MainThread) [custom_components.zha_toolkit] Default handler for zdo_scan_now
2023-08-16 18:53:05.359 DEBUG (MainThread) [custom_components.zha_toolkit] Handler: <function command_handler_default at 0x7f8a31de40>
2023-08-16 18:53:05.359 DEBUG (MainThread) [custom_components.zha_toolkit] running default command: <ServiceCall zha_toolkit.zdo_scan_now (c:01H7ZM7QNN0YFJNBQYXXXXXXXX)>
2023-08-16 18:53:05.362 DEBUG (MainThread) [custom_components.zha_toolkit.default] Trying to import custom_components.zha_toolkit.zdo to call zdo_scan_now
2023-08-16 18:53:05.365 DEBUG (MainThread) [custom_components.zha_toolkit.zdo] Scanning topology
2023-08-16 18:53:05.365 DEBUG (MainThread) [custom_components.zha_toolkit] event_data {'zha_toolkit_version': 'v0.9.7', 'zigpy_version': '0.56.2', 'zigpy_rf_version': '0.11.3', 'ieee_org': None, 'ieee': 'None', 'command': 'zdo_scan_now', 'command_data': None, 'start_time': '2023-08-16T16:53:05.359061+00:00', 'errors': [], 'params': {'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'task': <Task pending name='Task-1647255' coro=<Topology.scan() running at /usr/local/lib/python3.11/site-packages/zigpy/topology.py:86>>, 'success': True}
2023-08-16 18:53:05.372 ERROR (MainThread) [homeassistant.components.websocket_api.messages] Unable to serialize to JSON. Bad data found at $.result.response.task=<Task pending name='Task-1647255' coro=<Topology.scan() running at /usr/local/lib/python3.11/site-packages/zigpy/topology.py:96> wait_for=<Task pending name='Task-1647256' coro=<Topology._scan() running at /usr/local/lib/python3.11/site-packages/zigpy/topology.py:191> wait_for=<Future pending cb=[ZNP.wait_for_responses.<locals>.<lambda>() at /usr/local/lib/python3.11/site-packages/zigpy_znp/api.py:943, Task.task_wakeup()]> cb=[Task.task_wakeup()]>>(<class '_asyncio.Task'>
mdeweerd commented 10 months ago

Thanks. I am on vacation now but will try to reproduce this when I return 😉 .