Help Reading a BACnet network #519
Unanswered
dalijababe6
asked this question in
Q&A
Replies: 1 comment
-
Doing test with your code here, I get a wrong subnet mask when providing only the IP. It defaults to /24 but if like me, you are using something else... it fails to send broadcast messages. I also suggest that you use Also, I really like to use import BAC0
import socket
import asyncio
# Retrieving the IP address from the host PC
hostname = socket.gethostname()
host_ip = socket.gethostbyname(hostname) # Get the corresponding IP address
print(host_ip)
async def start_bacnet_server():
"""
Initialize the BACnet server and periodically update object values.
"""
async with BAC0.start(ip=host_ip, port=47811, deviceId=1112) as device1:
# Start BACnet on a specific IP and port
#device1 = BAC0.start(ip=host_ip, port=47811, deviceId=1112)
print("BACnet started. Discovering devices...")
# Discover devices (this may take some time)
await device1._discover()
# Wait a few seconds to allow device discovery to complete
#await asyncio.sleep(3)
# Get the discovered devices
devices = device1.discoveredDevices
print(f"Discovered devices: {devices}")
print("Pretty")
await device1.devices
if __name__ == "__main__":
asyncio.run(start_bacnet_server()) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am trying to read from a BACnet network configured on my localhost using the BAC0 library in Python. Below is the code I am using to send a general discovery request. However, every time I run it, no devices are discovered. This is confusing, as I have a BACnet network running and can test it using YABE.
What could be causing this issue, and how can I modify my code to ensure it works for discovering devices on any BACnet network?
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions