Copier template for Control4 driver projects. Contains shared infrastructure, build tooling, and common Lua libraries used across all Finite Labs drivers.
- preprocess — C preprocessor-style
#ifdef/#ifndeffor Lua, XML, and Markdown. Supports variant expansion for generating multiple driver configurations from a single source. - gen-squishy.lua — Auto-generates squishy files for squish (Lua module bundler) from driver.c4zproj.
- pandoc-remove-style.lua — Pandoc filter for cleaning up markdown when generating README from docs.
- bindings.lua — Binding management (add/remove/query Control4 driver bindings)
- conditionals.lua — Conditional/programming UI management
- events.lua — Event firing and management
- http.lua — HTTP client wrapper around C4:urlGet/urlPost/urlPut/urlDelete
- logging.lua — Structured logging with configurable levels (Fatal through Ultra)
- persist.lua — Persistent storage abstraction over C4 PersistData
- utils.lua — General utilities (XML parsing, device queries, table helpers, type coercion, etc.)
- values.lua (optional) — Value parsing, coercion, and formatting utilities
- github-updater.lua (optional) — GitHub Releases-based self-updater for non-DriverCentral builds
- JSON.lua — JSON encoder/decoder
- deferred.lua — Promise/deferred implementation for async workflows
- version.lua — Semantic version comparison
- cloud-client-byte.lua — DriverCentral cloud client
- drivers-common-public/ — Control4's official shared libraries (handlers, lib, timer, url)
- xml/ — XML parser (xml2lua)
- c4_shim.lua — Shim layer replacing C4 API calls with native Lua equivalents for local testing
- run_test.sh — Test runner script with LuaJIT
- Makefile — build, format, docs, package, and clean targets
- package.json — npm dependency declarations only (no scripts)
- CONTRIBUTING.md — explains how the template system works
- .gitignore, LICENSE, CHANGELOG.md, README.md
copier copy gh:finitelabs/control4-driver-template my-new-drivercd my-existing-driver
copier updateCopier will show diffs for any files that changed in the template and let you resolve conflicts.
| Variable | Description | Default |
|---|---|---|
project_name |
Project name (e.g., control4-esphome) |
— |
project_description |
Short description | A Control4 driver |
github_org |
GitHub organization | — |
distributions |
Space-separated build targets | drivercentral oss |
has_github_updater |
Include GitHub self-updater? | true |
has_tests |
Include test directory? | true |
readme_driver_slug |
Driver slug for README generation | — |
readme_build |
Build distribution for README | oss |
This template was created by unifying shared code from:
When the "best" version of a shared file differed across repos, the most complete/modern version was chosen:
- HC/ES version (identical, most complete): conditionals, http, logging, gen-squishy, pandoc-remove-style, drivers-common-public (handlers, timer, url)
- ES version (most advanced): preprocess (variant support), deferred (modern annotations), utils (core + binary serialization), drivers-common-public/lib
- ES/MQ version (identical): values, github-updater, version
- HC version (most complete): persist