An open API service indexing awesome lists of open source software.

https://github.com/bbartling/py-bacnet-stacks-playground

Another AI generated course work in Python for 20 minute daily challenges in the Python BACnet stacks with BAC0 and bacpypes3.
https://github.com/bbartling/py-bacnet-stacks-playground

Last synced: about 2 months ago
JSON representation

Another AI generated course work in Python for 20 minute daily challenges in the Python BACnet stacks with BAC0 and bacpypes3.

Awesome Lists containing this project

README

          

# Py BACnet Stacks Playground

[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2.svg?logo=discord&logoColor=white)](https://discord.gg/Ta48yQF8fC)

## **Applied Python + BACnet + Edge Automation for HVAC Controls Technicians, IoT Practitioners, and Building-Systems Tinkerers**

Welcome to the **Py BACnet Stacks Playground** β€” a hands-on, applied repository that starts with Python fundamentals and direct BACnet scripting, then evolves into **AI-assisted edge automation demos**.

The early *vibe code* apps stay grounded in **Python, BAC0, and BACpypes3**, where you build practical tools by directly interacting with BACnet devicesβ€”reading values, writing commands, inspecting priority arrays, and understanding real control behavior in the field.

From there, the project naturally expands into **VOLTTRON-based edge workflows**, where lightweight agents, platform services, and supervisory logic run continuously on a Raspberry Pi or edge gatewayβ€”bringing your scripts closer to real-world building automation deployments.

---

### πŸ€– AI-Assisted Workflows (New Direction)

This repository also doubles as **model context for AI-assisted development**, enabling tools like Open Claw to:

* Bootstrap environments (e.g., VOLTTRON installs, BACnet apps) automatically
* Generate and refine BACnet scripts and edge agents
* Assist with debugging, testing, and system setup
* Orchestrate multi-step workflows across the stack

The goal is simple:
πŸ‘‰ let AI handle the repetitive, time-consuming setup and glue code
πŸ‘‰ while you focus on **control logic, system behavior, and engineering insight**

---

### πŸš€ Where This Is Headed

* Python β†’ BACnet fundamentals β†’ real device interaction
* Edge deployment β†’ VOLTTRON agents β†’ continuous operation
* AI integration β†’ faster builds, smarter workflows, less manual setup

Ultimately, this repo becomes a **playground for building smarter buildings faster**β€”combining:

* Hands-on HVAC controls knowledge
* Open protocols like BACnet
* Edge computing
* And AI-driven development workflows

---

## Who This Is For

- **HVAC controls technicians** who want to automate scans, collect data, and build simple tools
- **IoT practitioners** working with building automation
- **Anyone** who knows BACnet from the field and wants to code it in Python and play around with AI!

---

## What You Will Learn

### Python (Applied Comp Sci 101)

- Variables, arithmetic, strings, lists, dictionaries
- Conditionals, loops, functions, modules, file I/O
- Error handling with `try`/`except`
- Simple algorithms: linear search, min/max, basic sorting
- Basic objects and instances (no advanced OOP)

**Scope:** Strings, lists, and dictionaries only. No advanced Python practices of list/dictionary comprehensions. No advanced data structures. See the `lessons` directory for the daily mini challenges and some of the YouTube videos demo theory lectures.

---

## Open Claw Model Routing Prompt

Just drop this prompt right into Open Clawβ€”it’s helped me avoid hitting API limits. I think it encourages the framework to use simple, low-cost models for easier tasks, while reserving more advanced (and expensive) models only for the tasks that truly require deeper reasoning.

```text
## Model Routing Policy
When analyzing test results, classify each task before processing:
SIMPLE (use primary model):
- Pass/fail test results
- HTTP status code errors (404, 500, timeout)
- Missing UI elements or broken selectors
- Test environment setup failures
- Syntax errors or import failures
COMPLEX (use thinking model)
- Unexpected behavior that passed but shouldn't have
- Race conditions or timing-dependent failures
- Security vulnerabilities
- Performance degradation patterns
- Failures that span multiple components or files
Default to SIMPLE unless the test result shows ambiguous or multi-layered behavior.
Always classify first, then process. Never use the thinking model for a task that fits the SIMPLE list.

```

---

## Vibe Code Checkpoints

| Checkpoint | What to Build | When |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **1** | **BAC0 + bacpypes3 basics:** read `present-value`, write to a point, write null (release), understand commandable objects + priority levels | **Week 1** |
| **2** | **RPM apps (BAC0 + bacpypes3):** ReadPropertyMultiple across devices, log to CSV, implement daily rotation (`csv` module) | **Week 2** |
| **3** | **Priority Array tools:** read + parse `priority-array`, inspect overrides, understand control authority | **Week 3** |
| **4** | **BACnet server apps:** mini device, schedule/calendar objects, weather server using OpenWeatherMap | **Week 4** |
| **5** | **Device discovery tools:** Who-Is / I-Am scanning, device enumeration (BAC0 + bacpypes3) | **Week 5** |
| **6** | **COV monitoring apps:** subscribe to Change-of-Value, stream live updates from devices | **Week 6** |
| **7** | **Open Claw + VOLTTRON bootstrap:** auto-provision VOLTTRON on edge (e.g., Raspberry Pi), build a simple BAS/BMS-style GUI (lightweight β€œvibe app”) | **Week 7** |
| **8** | **Advanced BAS web app:** React frontend + Caddy reverse proxy, clean API layer, evolve Week 7 into a more production-style UI | **Week 8** |
| **9 (TODO)** | **Rust BACnet stack:** integrate rusty-bacnet with Python bindings, rebuild key apps using Rust backend | **Future** |
| **(TODO)** | **Protocol debugging:** Wireshark + Linux tooling, inspect BACnet/IP traffic, validate and troubleshoot all apps built | **Final** |

---

### Notes / Direction

* Week 7–8 is where things get **really interesting** β†’ agentic workflows + real BAS-style UI
* Open Claw becomes your **automation layer** (bootstrapping, testing, orchestration)
* React + Caddy introduces **real-world web architecture patterns**
* Rust + Wireshark = **next-level protocol + performance understanding**

---

## Weekly Outline

### Week 1 β€” Fundamentals & First BACnet App
*Part I: Variables, operators, strings, numbers, booleans, input/output, lists*

- **Day 1 β€” Installing Python & Pip (BACnet Ready):** Set up Python, pip, BAC0, bacpypes3.
- **Day 2 β€” Variables & Arithmetic:** Store values, arithmetic, operator precedence.
- **Day 3 β€” Working with Strings:** Create, concatenate, index, slice strings.
- **Day 4 β€” Numbers, Booleans & Comparisons:** Numeric types, comparisons, truthiness.
- **Day 5 β€” User Input & Output:** `input()`, type conversion, f-strings.
- **Day 6 β€” Introducing Lists:** Create, index, slice, append, `len()`.
- **Day 7 β€” List Operations & Methods:** append, extend, insert, remove, sort, copy.

**Checkpoint 1:** BAC0 app β€” read, write, write null release.

---

### Week 2 β€” Control Structures & Data Collection
*Part II: Loops, conditionals, functions, files*

- **Day 8 β€” For Loops & Range:** Iterate over lists/strings/ranges, `enumerate()`.
- **Day 9 β€” Conditionals & While Loops:** `if`/`elif`/`else`, `while`, sentinel loops.
- **Day 10 β€” String Methods: Split, Join & Case:** `split()`, `join()`, case conversion.
- **Day 11 β€” Introducing Dictionaries:** Keys, values, add, retrieve, membership.
- **Day 12 β€” Looping over Dictionaries:** `items()`, `keys()`, `values()` (no comprehensions).
- **Day 13 β€” Tuples & Sets (Light):** Immutable tuples, sets for membership (optional).
- **Day 14 β€” Loops & Sentinels:** `break`, `continue`, common loop patterns.

---

### Week 3 β€” Functions, Modules & Files
*Part II continued: Reusable code, modules, file I/O*

- **Day 15 β€” Writing Functions:** Define functions, parameters, return, docstrings.
- **Day 16 β€” Modules & the Standard Library:** `math`, `random`, organising code.
- **Day 17 β€” Reading & Writing Files:** `open()`, `with`, read/write text and CSV.
- **Day 18 β€” Handling Errors:** `try`/`except`, robust programs.
- **Day 19 β€” Week 3 Review:** CSV of sensor readings, statistics, error handling.
- **Day 20 β€” Built-in Functions:** `min()`, `max()`, `sorted()`, `sum()`, `zip()` (no comprehensions).
- **Day 21 β€” Slicing & String Formatting:** Advanced f-strings, slicing.

**Checkpoint 2:** BAC0 app β€” collect data, save to CSV, rotate logs per day.
**Checkpoint 3:** bacpypes3 read/write/release app.

---

### Week 4 β€” Data Structures & Discovery
*Part III: Lists, dicts, file I/O*

- **Day 22 β€” Working with Nested Data:** Lists of dicts, dicts of lists (loops only, no comprehensions).
- **Day 23 β€” Random & Math:** `random`, `math` for simulations.
- **Day 24 β€” any(), all() & Simple Patterns:** Boolean checks on collections.
- **Day 25 β€” Documentation & help():** Docstrings, comments, `help()`.
- **Day 26 β€” Week 4 Review:** Nested data, built-ins, loops.
- **Day 27 β€” What Is an Algorithm?:** Steps, efficiency, problem decomposition.
- **Day 28 β€” Linear Search:** Implement and analyse linear search.

**Checkpoint 4:** BACnet discover β†’ CSV (Who-Is, object list, properties).

---

### Week 5 β€” Algorithms & BACnet Servers
*Part IV: Simple algorithms, objects, final project*

- **Day 29 β€” Finding Min & Max:** Compute smallest/largest in a list.
- **Day 30 β€” Counting Occurrences:** Frequency tables with dictionaries.
- **Day 31 β€” Sorting Lists:** Basic sorting, `sort()` and `sorted()`.
- **Day 32 β€” String Algorithms:** Substring search, prefixes, suffixes.
- **Day 33 β€” Membership & Searching:** `in`, sets, dict lookups.
- **Day 34 β€” Aggregating Data:** Sums, averages, simple statistics.
- **Day 35 β€” Final Project:** Web weather station BACnet server.

**Checkpoint 5:** Mini BACnet device + mini schedule/calendar device.
**Final Project:** Open Weather Map API β†’ BACnet server.

---

### Week 6 β€” Bonus: Operations
*Troubleshooting & deployment*

- **Day 36 β€” Playing with a Mini BACnet Device:** Run mini-device-revisited.py, read/write, simple control logic.
- **Day 37 β€” Scheduling with a Mini BACnet Calendar Device:** Run mini-schedule-calendar-device.py, read schedule/calendar.
- **Day 38 β€” Troubleshooting BACnet with Wireshark:** Capture BACnet/IP with tcpdump, inspect in Wireshark.
- **Day 39 β€” Deploying a CSV Scraper with systemd:** systemd service for auto-start and restart.
- **Day 40 β€” Containerising Your Scraper with Docker:** Docker container, restart policies.

---

## License

MIT License β€” use, remix, share forward. Built for the BAS community.