{"id":35101407,"url":"https://github.com/bbartling/diy-bacnet-server","last_synced_at":"2026-04-24T00:36:02.803Z","repository":{"id":218412069,"uuid":"746304528","full_name":"bbartling/diy-bacnet-server","owner":"bbartling","description":"Fast BACnet server deployment!","archived":false,"fork":false,"pushed_at":"2026-04-23T14:18:22.000Z","size":510,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-23T15:29:36.746Z","etag":null,"topics":["bacnet","bacnet-ip","bacnet-server","building-automation","docker","edge-computing","fastapi","hvac","hvac-iot","iot","rpc-json","rpc-server"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbartling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-01-21T17:12:02.000Z","updated_at":"2026-04-23T14:21:03.000Z","dependencies_parsed_at":"2024-11-08T13:15:40.870Z","dependency_job_id":"6128cab2-8a0f-432b-b989-c3462cb49283","html_url":"https://github.com/bbartling/diy-bacnet-server","commit_stats":null,"previous_names":["bbartling/rusty-bacnet","bbartling/diy-bacnet-server-rs","bbartling/diy-bacnet-server"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bbartling/diy-bacnet-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fdiy-bacnet-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fdiy-bacnet-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fdiy-bacnet-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fdiy-bacnet-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbartling","download_url":"https://codeload.github.com/bbartling/diy-bacnet-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fdiy-bacnet-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32204710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T00:06:41.111Z","status":"ssl_error","status_checked_at":"2026-04-24T00:06:35.224Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bacnet","bacnet-ip","bacnet-server","building-automation","docker","edge-computing","fastapi","hvac","hvac-iot","iot","rpc-json","rpc-server"],"created_at":"2025-12-27T16:59:54.694Z","updated_at":"2026-04-24T00:36:02.797Z","avatar_url":"https://github.com/bbartling.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## diy-bacnet-server\n\n[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2.svg?logo=discord\u0026logoColor=white)](https://discord.gg/Ta48yQF8fC)\n[![CI](https://github.com/bbartling/diy-bacnet-server/actions/workflows/ci.yml/badge.svg)](https://github.com/bbartling/diy-bacnet-server/actions/workflows/ci.yml)\n![MIT License](https://img.shields.io/badge/license-MIT-green.svg)\n![Development Status](https://img.shields.io/badge/status-Beta-blue.svg)\n![Python](https://img.shields.io/badge/Python-3.12%2B-blue?logo=python\u0026logoColor=white)\n\nLightweight BACnet/IP + JSON-RPC edge microservice for Docker-based deployments, including optional Modbus TCP client features.\n\n\n## Quick Start\n\nThis app uses bacpypes3 CLI-style arguments to configure a BACnet server (`--name`, `--instance`, `--address`), similar to running commands directly in the bacpypes3 shell. \n\n### BACnet Shell Reference\n\nThis is a mini tutorial for bacpypes3, which is great for troubleshooting and serves as a useful step for testing deployments before moving on to the DIY BACnet server application.\n\n```bash\n# Create virtual environment\npython -m venv env\n\n# Activate (Linux / macOS)\n. env/bin/activate\n\n# Install dependencies\npip install bacpypes3 ifaddr\n```\n\n### Run bacpypes3 Test Instance\n\nThe bacpypes3 library supports a shell mode out of the box, as shown directly below. Further down, we’ll cover setup for the full-featured DIY BACnet server, which includes a web app powered by FastAPI and supports easy Docker deployments.\n\n\n```bash\npython -m bacpypes3 \\\n  --name BensRawBacpypes3Test \\\n  --address 192.168.204.12/24 \\\n  --instance 123456 \\\n  --debug\n```\n\nThis will start a basic BACnet device on your network for testing discovery (`whois`) and communication.\n\n\nWhen running the bacpypes3 module interactively:\n```bash\n\u003e help\ncommands: config, exit, help, iam, ihave, irt, rbdt, read, rfdt, rpm, wbdt, whohas, whois, wirtn, write\n```\n\n#### Example: Device Discovery (`whois`)\n\n\n\u003e **NOTE:** If the step below does not work, the entire web application framework will not function. This step is critical.\n\u003e The `whois` command also accepts a range of BACnet instance IDs. For example: `\u003e whois 1 100`.\n\n\n```bash\n\u003e whois\n```\n\nExample output (trimmed):\n\n```\n3456788 192.168.204.16\n3456789 192.168.204.13\n3456790 192.168.204.14\n```\n\n#### Common Commands\n\n```bash\n# Discover devices in a range\nwhois 1000 3456799\n\n# Read a point\nread 192.168.204.13 analog-input,1 present-value\n\n# Write a value (priority 9)\nwrite 192.168.204.14 analog-output,1 present-value 999.8 9\n\n# Release a command (null write)\nwrite 192.168.204.14 analog-output,1 present-value null 9\n```\n\n---\n\n## Server Flags\n\nThe app supports the same flags as bacpypes3:\n\n* `--name` → Device name\n* `--instance` → Device instance ID\n* `--address` → IP/subnet/port (optional)\n* `--public` → Enable LAN HTTP access + `/docs`\n\n\u003e Tip: Omit `--address` when a single NIC is sufficient.\n\n---\n\n## Python (Local Setup) diy-bacnet-server\n\nThis example sets up the `diy-bacnet-server` server locally and generates a Bearer token via a `.env` file.\n\n```bash\ngit clone https://github.com/bbartling/diy-bacnet-server.git\ncd diy-bacnet-server\n\npython3 -m venv .venv\n. .venv/bin/activate\n\npip install -e \".[dev]\"\n\n# Create API key\nprintf 'BACNET_RPC_API_KEY=%s\\n' \"$(openssl rand -hex 32)\" \u003e .env\n\n# Load environment variables\nset -a \u0026\u0026 . ./.env \u0026\u0026 set +a\n\n# Run server\npython -m bacpypes_server.main \\\n  --name my-device \\\n  --instance 123456 \\\n  --address 192.168.204.18/24:47808 \\\n  --public \\\n  --debug\n```\n\n---\n\n## Accessing the API\n\nWith `--public` enabled:\n\n* Open API docs:\n\n  ```\n  http://127.0.0.1:8080/docs\n  ```\n\n  (or use the host’s LAN IP from another machine)\n\n### Authentication\n\n* `POST /server_hello` → No auth required\n* All other JSON-RPC endpoints → Require Bearer token (if API key is set)\n\n---\n\n## Notes\n\n* Ensure UDP port **47808** is open for BACnet discovery (Who-Is / I-Am).\n* The `.env` file is optional for local, unsecured loopback testing.\n* Behavior should match standard bacpypes3 discovery and communication patterns.\n\n### Common Gotcha: Firewall (Same Story as BACnet)\n\nThe most common issue is firewall configuration.\n\nYou may already have UDP `47808` open for BACnet, but the HTTP API (JSON-RPC / Swagger) runs on **TCP 8080**. This can cause a confusing situation where:\n\n* `curl` or browser **works locally on the server**\n* but **fails from another machine on the LAN**\n\n#### Fix (UFW examples)\n\nAllow port 8080:\n\n```bash\nsudo ufw allow in on enp3s0 to any port 8080 proto tcp comment 'diy-bacnet HTTP'\n```\n\nOr more broadly:\n\n```bash\nsudo ufw allow 8080/tcp\n```\n\nVerify:\n\n```bash\nsudo ufw status numbered\n```\n\n#### Test from another machine on the LAN\n\n```bash\ncurl -sS -o /dev/null -w '%{http_code}\\n' http://192.168.204.18:8080/docs\n```\n\nExpected result:\n\n```\n200\n```\n\nIf you don’t see `200`, it’s almost always a firewall or network interface binding issue.\n\n---\n\n## Docker diy-bacnet-server\n\n`--network host` is a Docker option: the container shares the host’s network stack instead of a private bridge/NAT network. That keeps BACnet/IP (UDP broadcasts and port 47808) behaving like running Python directly on the machine. Swagger **Authorize** still uses the same `BACNET_RPC_API_KEY` value you put in `.env`. Skip `git clone` / `cd` if you already have the repo.\n\n```bash\ngit clone https://github.com/bbartling/diy-bacnet-server.git\ncd diy-bacnet-server\nprintf 'BACNET_RPC_API_KEY=%s\\n' \"$(openssl rand -hex 32)\" \u003e .env\ndocker build -t diy-bacnet-server .\ndocker run --rm -it --network host --env-file .env --name diy-bacnet-gateway diy-bacnet-server \\\n  python3 -u -m bacpypes_server.main \\\n  --name asdf --instance 123456 --address 192.168.204.18/24:47808 --public --debug\n```\n\nSwagger **Authorize** uses the same `BACNET_RPC_API_KEY` value as in that file.\n\n---\n\n## Online Documentation\n\nThis application is part of a broader ecosystem that together forms the **Open FDD AFDD Stack**, enabling a fully orchestrated, edge-deployable analytics and optimization platform for building automation systems.\n\n* 🔗 **DIY BACnet Server**\n  Lightweight BACnet server with JSON-RPC and MQTT support for IoT integrations.\n  [Documentation](https://bbartling.github.io/diy-bacnet-server/) · [GitHub](https://github.com/bbartling/diy-bacnet-server)\n\n* 📖 **Open FDD AFDD Stack**\n  Full AFDD framework with Docker bootstrap, API services, drivers, and React web UI.\n  [Documentation](https://bbartling.github.io/open-fdd-afdd-stack/) · [GitHub](https://github.com/bbartling/open-fdd-afdd-stack)\n\n* 📘 **Open FDD Fault Detection Engine**\n  Core rules engine with `RuleRunner`, YAML-based fault logic, and pandas workflows.\n  [Documentation](https://bbartling.github.io/open-fdd/) · [GitHub](https://github.com/bbartling/open-fdd) · [PyPI](https://pypi.org/project/open-fdd/)\n\n* ⚙️ **easy-aso Framework**\n  Lightweight framework for Automated Supervisory Optimization (ASO) algorithms at the IoT edge.\n  [Documentation](https://bbartling.github.io/easy-aso/) · [GitHub](https://github.com/bbartling/easy-aso) · [PyPI](https://pypi.org/project/easy-aso/0.1.7/)\n\n\n---\n\n\n## Dependencies\n\n* Python 3.12+\n* `bacpypes3`\n* `ifaddr`\n* `fastapi-jsonrpc`\n* `uvicorn`\n* `requests`\n* `httpx`\n* `aiomqtt`\n* `pyModbusTCP\u003e=0.2.0`\n* `pip` + virtual environment tooling (`python3 -m venv`)\n* Docker (for container runs; use `--network host` for BACnet/IP behavior)\n* OpenSSL (optional, used in examples to generate `BACNET_RPC_API_KEY`)\n\n---\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fdiy-bacnet-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbartling%2Fdiy-bacnet-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fdiy-bacnet-server/lists"}