Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BACNET IP Connection #517

Open
GSK72 opened this issue Jan 21, 2025 · 1 comment
Open

BACNET IP Connection #517

GSK72 opened this issue Jan 21, 2025 · 1 comment

Comments

@GSK72
Copy link

GSK72 commented Jan 21, 2025

Hi,
I am new to this; I am dealing with an issue where I would want to connect to a JCI controller via BACNET using PyCharm. I am using a USB to ethernet dongle to connected to the controller, it is giving me an error message or saying that there is no discovered devices. Here is the code:
import BAC0
import asyncio

async def start_bacnet_server():
# Initialize a BAC0 BAC.lite server
print("Starting BACnet server...")
bacnet = BAC0.lite(ip= "192.168.10.7/0") #

#dev = BAC0.connect(ip= "192.168.10.12/0")

bacnet.discover()

print("discovered devices:", bacnet.discoveredDevices)

# Keep the server running
try:
    while True:
        await asyncio.sleep(1)
except asyncio.CancelledError:
    print("Shutting down BACnet server...")
    #bacnet.stop()

async def main():
# Start the BACnet server in an asyncio task
task = asyncio.create_task(start_bacnet_server())
try:
await asyncio.sleep(1)
except KeyboardInterrupt:
task.cancel()
await task

if name == "main":
asyncio.run(main())

I know there is a difference between BACnet IP and being able to connect to the controller through ethernet to program it. Is there something that I missing relating to connecting the controller or should I also invest in a BACnet IP router?

Thanks!

@ChristianTremblay
Copy link
Owner

Try /24 instead of /0, given that "192.168.10.12/24" is the IP of your network interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants