You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2025-01-09 14:35:05,917 - INFO | Starting Asynchronous BAC0 version 2024.09.10 (Lite)
2025-01-09 14:35:05,920 - INFO | Using bacpypes3 version 0.0.98
2025-01-09 14:35:05,921 - INFO | Use BAC0.log_level to adjust verbosity of the app.
2025-01-09 14:35:05,921 - INFO | Ex. BAC0.log_level('silence') or BAC0.log_level('error')
Traceback (most recent call last):
File "C:\Users\dmaske\Desktop\New folder\test_bacnet.py", line 7, in
bacnet = BAC0.connect(bbmdAddress=bbmdIP, bbmdTTL=bbmdTTL) # Connect
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dmaske\AppData\Roaming\Python\Python311\site-packages\BAC0\scripts\Lite.py", line 141, in init
self._ping_task.start()
File "C:\Users\dmaske\AppData\Roaming\Python\Python311\site-packages\BAC0\tasks\TaskManager.py", line 143, in start
self.aio_task = asyncio.create_task(self.execute(), name=f"aio{self.name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\tasks.py", line 371, in create_task
loop = events.get_running_loop()
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine 'Task.execute' was never awaited
What I Have Tried Running the script with different variations of BAC0.lite() and BAC0.connect(), but the error persists. Verified that my BACnet devices are accessible using Yabe software, where I can register and discover all devices successfully. Experimented with adding an event loop manually, but it didn't work. Why is asyncio.create_task() failing with RuntimeError: no running event loop? How can I properly connect to a foreign BACnet device using BAC0? Are there any workarounds or configurations I need to change?
The text was updated successfully, but these errors were encountered:
I am trying to connect to a BACnet foreign device using the BAC0 Python library. Below is my script:
import BAC0
print(BAC0.version)
bbmdIP = '10.x.y.z:47808' # Replace with actual IP
bbmdTTL = 900
bacnet = BAC0.lite(bbmdAddress=bbmdIP, bbmdTTL=bbmdTTL) # Connect
print(bacnet.vendorName.strValue)
print(bacnet.modelName.strValue)
whois_results = bacnet.whois()
print("WhoIs results:", whois_results)
print(bacnet.devices)
bacnet.discover(networks='known')
However, I keep getting the following error:
2025-01-09 14:35:05,917 - INFO | Starting Asynchronous BAC0 version 2024.09.10 (Lite)
2025-01-09 14:35:05,920 - INFO | Using bacpypes3 version 0.0.98
2025-01-09 14:35:05,921 - INFO | Use BAC0.log_level to adjust verbosity of the app.
2025-01-09 14:35:05,921 - INFO | Ex. BAC0.log_level('silence') or BAC0.log_level('error')
Traceback (most recent call last):
File "C:\Users\dmaske\Desktop\New folder\test_bacnet.py", line 7, in
bacnet = BAC0.connect(bbmdAddress=bbmdIP, bbmdTTL=bbmdTTL) # Connect
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dmaske\AppData\Roaming\Python\Python311\site-packages\BAC0\scripts\Lite.py", line 141, in init
self._ping_task.start()
File "C:\Users\dmaske\AppData\Roaming\Python\Python311\site-packages\BAC0\tasks\TaskManager.py", line 143, in start
self.aio_task = asyncio.create_task(self.execute(), name=f"aio{self.name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\tasks.py", line 371, in create_task
loop = events.get_running_loop()
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine 'Task.execute' was never awaited
What I Have Tried Running the script with different variations of BAC0.lite() and BAC0.connect(), but the error persists. Verified that my BACnet devices are accessible using Yabe software, where I can register and discover all devices successfully. Experimented with adding an event loop manually, but it didn't work. Why is asyncio.create_task() failing with RuntimeError: no running event loop? How can I properly connect to a foreign BACnet device using BAC0? Are there any workarounds or configurations I need to change?
The text was updated successfully, but these errors were encountered: