Error - BACnet stack not running #482
Replies: 4 comments
-
You are probably facing an asynchronous issue where the app is not yet started... without seeing the code it's hard to tell. _started is define at the end of the initialization of the instance (Base.py line 254) |
Beta Was this translation helpful? Give feedback.
-
Hi, Christian:
My code definitely reaches your startApp() method, and self._started is set
to True (I set breakpoints and traced the execution). These are some log
messages when my app starts indicating that BAC0 is starting:
2024-09-23 06:36:04,664 - INFO | Starting Asynchronous BAC0 version
2024.09.10 (Lite)
2024-09-23 06:36:04,664 - INFO | Using bacpypes3 version 0.0.98
2024-09-23 06:36:04,664 - INFO | Use BAC0.log_level to adjust
verbosity of the app.
2024-09-23 06:36:04,664 - INFO | Ex. BAC0.log_level('silence') or
BAC0.log_level('error')
2024-09-23 06:36:04,717 - INFO | Using ip : 192.168.1.159/24 on port
47808 | broadcast : 192.168.1.255
2024-09-23 06:36:04,734 - INFO | Using default JSON configuration
file
At this point, my app is able to find networks and devices using await
bacnet._discover(networks='known') no problem. It is only when my app uses
Read.py to read multiple properties does it fail:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in
run_until_complete
return future.result()
File "/home/devadmin/PycharmProjects/bacnet_scanner_bac0/main.py", line
240, in main
bacnet_device = await device_object.get_device_properties(bacnet,
router_dict, device, app_logger)
File
"/home/devadmin/PycharmProjects/bacnet_scanner_bac0/device_object.py", line
70, in get_device_properties
await bacnet.readMultiple(f"{address} device {device_id} objectName
vendorName description "
File
"/home/devadmin/PycharmProjects/bacnet_scanner_bac0/.venv/lib/python3.10/site-packages/BAC0/core/io/Read.py",
line 237, in readMultiple
raise ApplicationNotStarted("BACnet stack not running - use startApp()")
BAC0.core.io.IOExceptions.ApplicationNotStarted: BACnet stack not running -
use startApp()
I see how self._started is set in Base.py, but I don't see how that is set
in Read.py.
Here is how I instantiate BAC0:
bacnet = None
BAC0.log_level(log_file=None, stdout=None)
try:
async with BAC0.start(ip) as temp_bacnet:
bacnet = temp_bacnet
except BAC0.core.io.IOExceptions.InitializationError as e:
print(f'Failed to start BACnet scanner. Is your specified IP
address provided valid?: {ip}')
sys.exit()
On a separate note, I had no idea BAC0 instantiated its own BACnet device.
I did see that device listed along with the other devices my app finds on
the network. That seems like a great feature, but my app is intended only
to list the real discovered devices; is there a way to keep the BAC0
emulated device from running?
…On Sun, Sep 22, 2024 at 9:25 PM Christian Tremblay ***@***.***> wrote:
You are probably facing an asynchronous issue where the app is not yet
started... without seeing the code it's hard to tell.
_started is define at the end of the initialization of the instance
(Base.py line 254)
—
Reply to this email directly, view it on GitHub
<#482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2RCXQA2S7LQMB2LR3KPADZX5UZPAVCNFSM6AAAAABOU4X4EWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZSGEZDANY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It's a central piece of all the work around BAC0 and BACpypes[3] This device participate to the BACnet network and must be running at all time to be sure everything works. This is completely different of a standard REST API logic where you just make request to a server. I suspect your bacnet variable is not running all the time while your script runs, causing the _started value to be False at some point. |
Beta Was this translation helpful? Give feedback.
-
Christian, thank you for clarifying the role of BAC0 as a BACnet device
itself -- that makes good sense to me.
Concerning self._started, I still don't know what's going on. If I set
breakpoints in Base.py and Read.py and inspect the object ids using
id(self._started), this is what I see:
In Base.py: 94244198122528
In Read.py: 94244198122496
These are two separate object instances. That seems reasonable as I don't
see how "_started" is passed from Base.py to Read.py.
…On Mon, Sep 23, 2024 at 11:06 PM Christian Tremblay < ***@***.***> wrote:
It's a central piece of all the work around BAC0 and BACpypes[3]
The application *is* a BACnet device.
This device participate to the BACnet network and must be running at all
time to be sure everything works. This is completely different of a
standard REST API logic where you just make request to a server.
I suspect your bacnet variable is not running all the time while your
script runs, causing the _started value to be False at some point.
—
Reply to this email directly, view it on GitHub
<#482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2RCXVUANMXWZZP4NGNN2DZYDJLBAVCNFSM6AAAAABOU4X4EWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZTGM2DEOA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I get this error when attempting to read properties from my devices:
However, if I comment out these lines in BAC0.core.io.Read.py, the app runs fine:
I cannot find what sets "self._started" True. I'm using BAC0 version 2024.9.20.
Beta Was this translation helpful? Give feedback.
All reactions