This release is a pre-release and may not be stable for production use.
BACnet Scan Tool API
About
The BACnet Scan Tool is a FastAPI-based web service that provides a comprehensive interface for discovering, communicating with, and managing BACnet devices on your network. This tool acts as a bridge between web applications and BACnet networks, offering both REST API endpoints and an interactive web interface for BACnet operations.
Key Features
- Device Discovery: Scan IP ranges to automatically discover BACnet devices using Who-Is requests
- Property Operations: Read and write BACnet device properties with full support for array indices and priority levels
- Network Intelligence: Automatically detect local network interfaces and provide guidance for optimal scanning
- Cross-Platform Support: Works on Linux, Windows, and WSL2 environments with automatic network configuration
- Interactive API: Built-in Swagger UI for easy testing and exploration of all endpoints
Use Cases
- Building Automation Integration: Connect web applications to BACnet building systems
- Network Commissioning: Discover and verify BACnet devices during installation
- System Monitoring: Read device properties for monitoring and reporting applications
- Device Configuration: Write properties to configure BACnet devices remotely
- Network Troubleshooting: Identify and diagnose BACnet communication issues
This tool is particularly useful for developers building web-based building automation systems, facility managers needing to monitor BACnet networks, and system integrators working with BACnet devices.
Build
To build the bacnet-scan-tool, ensure you have Python 3.10 or higher installed, then run the following commands:
# Clone the repository
git clone https://github.com/your-repo/bacnet-scan-tool.git
cd bacnet-scan-tool
Install Poetry
This project uses Poetry for dependency management. To install Poetry, run:
# Using the official installation script
curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to your PATH (if not already added)
export PATH="$HOME/.local/bin:$PATH"
Verify the installation:
poetry --version
Setup Virtual Environment
Once Poetry is installed, set up the virtual environment and install dependencies:
# Install dependencies
poetry install
Usage
Start the FastAPI Web Server
Start the server with Poetry:
poetry run uvicorn bacnet_scan_tool.main:app --reload
The server will be available at http://127.0.0.1:8000. Access the UI here: http://127.0.0.1:8000/docs
BACnet Scan Tool – Usage Guide & API Workflow
Recommended Flow
-
Start the BACnet Proxy
- POST /start_proxy
- Call with no parameters to auto-select your machine’s main outbound IP (recommended for most users).
- Advanced: Provide
local_device_addressto bind to a specific local IP/interface. - Returns:
{ "status": "done", "address": "192.168.1.100" }
On error:{ "status": "error", "error": "Proxy not registered or missing socket_params." }
- POST /start_proxy
-
(Optional) Check Your Local IP
- GET /get_local_ip
- Returns the local IP, subnet mask, and CIDR for the interface used to reach a target IP (default is 8.8.8.8).
- Returns:
{ "local_ip": "192.168.1.100", "subnet_mask": "255.255.255.0", "cidr": "192.168.1.100/24" }
On error:{ "local_ip": "127.0.0.1", "error": "Could not determine local IP." }
- GET /get_local_ip
-
(Optional, for WSL2 Users) Get Windows Host IP
- GET /get_windows_host_ip
- Returns the first non-loopback IPv4 address from the Windows host (helpful for WSL2 environments).
- Returns:
{ "windows_host_ip": "192.168.1.50" }
- Tip: Use this if you know your BACnet device is on the same network as your Windows host. You can use the returned IP to determine the correct subnet for scanning.
- GET /get_windows_host_ip
-
Scan for BACnet Devices
- POST /bacnet/scan_ip_range
- Form Data:
network_str(CIDR, e.g.,192.168.1.0/24) - Description: Scans the given IP range for BACnet devices and returns a list of discovered devices with their identifiers and object names.
- Returns (success):
{ "status": "done", "devices": [ { "pduSource": "192.168.1.101", "deviceIdentifier": "8,123456", "maxAPDULengthAccepted": 1024, "segmentationSupported": "segmented-both", "vendorID": 5, "object-name": "Device-A", "scanned_ip_target": "192.168.1.101", "device_instance": 123456 }, { "pduSource": "192.168.1.102", "deviceIdentifier": "8,789012", "maxAPDULengthAccepted": 1024, "segmentationSupported": "segmented-both", "vendorID": 5, "object-name": "Device-B", "scanned_ip_target": "192.168.1.102", "device_instance": 789012 } ] }
If no devices found:{ "status": "done", "devices": [] }
On error:{ "status": "error", "error": "Proxy not registered or missing, cannot scan." }
- Tip: If you are unsure of your network range, use
/get_local_ipor/get_windows_host_ipto help determine the correct subnet.
- Form Data:
- POST /bacnet/scan_ip_range
-
Read or Write Properties
- POST /read_property
- Form Data:
device_address,object_identifier,property_identifier,property_array_index(optional) - Returns: Value of the property.
- Form Data:
- POST /write_property
- Form Data:
device_address,object_identifier,property_identifier,value,priority,property_array_index(optional) - Returns: Result of the write operation.
- Form Data:
- Note:
property_array_indexis only needed for array properties—leave blank for most reads/writes.
- POST /read_property
-
Stop the Proxy
- POST /stop_proxy
- Stops the running BACnet proxy and cleans up state.
- Returns: Status message.
- POST /stop_proxy
Flow Summary
- Start the proxy (auto-selects the best local IP by default)
- (Optional) Check your local or Windows host IP
- Scan for devices on your network
- Read/write properties as needed
- Stop the proxy when done
API Endpoints
1. Start BACnet Proxy
- POST /start_proxy
- Description: Start the BACnet proxy with the given local device address (IP).
- Form Data:
local_device_address: Local IP address to bind the proxy.
- Returns: Status and address.
2. Stop BACnet Proxy
- POST /stop_proxy
- Description: Stop the running BACnet proxy and clean up state.
- Returns: Status message.
3. Write Property
- POST /write_property
- Description: Write a value to a specific property of a BACnet device.
- Form Data:
device_address,object_identifier,property_identifier,value,priority,property_array_index(optional)
- Returns: Result of the write operation.
4. Read Property
- POST /read_property
- Description: Read a property from a BACnet device.
- Form Data:
device_address,object_identifier,property_identifier,property_array_index(optional)
- Returns: Value of the property.
5. Ping IP
- POST /ping_ip
- Description: Ping an IP address and return the result.
- Form Data:
ip_address: IP address to ping.
- Returns: Success status and ping output.
6. Scan IP Range for BACnet Devices
- POST /bacnet/scan_ip_range
- Description: Scan a range of IPs for BACnet devices using Who-Is.
- Form Data:
network_str: Subnet in CIDR notation (e.g.,192.168.1.0/24).
- Returns: List of discovered devices.
7. Read All Device Properties
- POST /bacnet/read_device_all
- Description: Read all standard properties from a BACnet device.
- Form Data:
device_address,device_object_identifier
- Returns: All properties as JSON.
8. Who-Is
- POST /bacnet/who_is
- Description: Send a Who-Is request to a BACnet address or range.
- Form Data:
device_instance_low,device_instance_high,dest
- Returns: List of devices found.
9. Get Local IP
- GET /get_local_ip
- Description: Returns the local IP address your machine would use to reach a given BACnet device or network.
- Query Parameter:
target_ip: The IP address of the BACnet device or network you want to reach.
- Returns: Local IP address
You can also use the interactive API documentation:
- Swagger UI: http://127.0.0.1:8000/docs
- ReDoc: http://127.0.0.1:8000/redoc
Metadata
Release files for bacnet-scan-tool 0.1.0rc0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bacnet_scan_tool-0.1.0rc0.tar.gz | 21.9 kB | Without provenance | Details for bacnet_scan_tool-0.1.0rc0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bacnet_scan_tool-0.1.0rc0-py3-none-any.whl | Python 3 | none | any | Details for bacnet_scan_tool-0.1.0rc0-py3-none-any.whl |
Total release size: 42.8 kB
Release files / bacnet_scan_tool-0.1.0rc0.tar.gz
| Download URL | bacnet_scan_tool-0.1.0rc0.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27670f36d0c21596c11e523c81a23d6df5ca3ffba072788a3bc69d6afca5e65d
|
|
BLAKE2b-256 checksum How to use checksums |
5f756fc5b09614f74fe39eb74585762d8fa35e7536686a6d1414ea76f670d1d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.18 Linux/6.8.0-1031-azure
|
Release files / bacnet_scan_tool-0.1.0rc0-py3-none-any.whl
| Download URL | bacnet_scan_tool-0.1.0rc0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d848b6a910897b88f13d47b28a8af6ca7160832be8d60a5af620fb36541e75e0
|
|
BLAKE2b-256 checksum How to use checksums |
6a2d6a673df7641da2b59e576110374fcd377a5957d21d25d369012a949dc0cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.10.18 Linux/6.8.0-1031-azure
|
Security for bacnet-scan-tool 0.1.0rc0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.