crestron-setup 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crestron_setup-0.0.0/.github/prompts/crestron-cli.prompt.md +33 -0
- crestron_setup-0.0.0/.github/workflows/release.yml +125 -0
- crestron_setup-0.0.0/.gitignore +7 -0
- crestron_setup-0.0.0/AGENTS.md +79 -0
- crestron_setup-0.0.0/LICENSE +21 -0
- crestron_setup-0.0.0/PKG-INFO +105 -0
- crestron_setup-0.0.0/README.md +75 -0
- crestron_setup-0.0.0/config.example.yaml +49 -0
- crestron_setup-0.0.0/crestron_command_reference.md +5087 -0
- crestron_setup-0.0.0/crestron_setup/__init__.py +6 -0
- crestron_setup-0.0.0/crestron_setup/__main__.py +6 -0
- crestron_setup-0.0.0/crestron_setup/cli.py +481 -0
- crestron_setup-0.0.0/crestron_setup/config.py +109 -0
- crestron_setup-0.0.0/crestron_setup/discovery.py +193 -0
- crestron_setup-0.0.0/crestron_setup/firmware.py +151 -0
- crestron_setup-0.0.0/crestron_setup/models.py +64 -0
- crestron_setup-0.0.0/crestron_setup/provisioning.py +735 -0
- crestron_setup-0.0.0/crestron_setup/ssh.py +339 -0
- crestron_setup-0.0.0/crestron_setup/timezones.py +168 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/PKG-INFO +105 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/SOURCES.txt +28 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/dependency_links.txt +1 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/entry_points.txt +2 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/requires.txt +5 -0
- crestron_setup-0.0.0/crestron_setup.egg-info/top_level.txt +1 -0
- crestron_setup-0.0.0/example commands.txt +154 -0
- crestron_setup-0.0.0/packaging/scoop/crestron-setup.json +13 -0
- crestron_setup-0.0.0/pyproject.toml +48 -0
- crestron_setup-0.0.0/setup.cfg +4 -0
- crestron_setup-0.0.0/setup_processor.sh +660 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Look up Crestron processor CLI commands, syntax, and parameters
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Crestron CLI Command Reference
|
|
6
|
+
|
|
7
|
+
You have access to a comprehensive Crestron CP4 command reference database at [crestron_command_reference.md](../../crestron_command_reference.md).
|
|
8
|
+
|
|
9
|
+
## When to Use
|
|
10
|
+
|
|
11
|
+
Use this skill when the user needs to:
|
|
12
|
+
|
|
13
|
+
- Look up the syntax or parameters for a Crestron CLI command
|
|
14
|
+
- Find which command performs a specific function on a Crestron processor
|
|
15
|
+
- Understand available commands by role (Administrator, Operator, Programmer, Connect)
|
|
16
|
+
- Write or modify `expect` scripts that interact with the Crestron CLI
|
|
17
|
+
- Troubleshoot command usage or errors on a Crestron processor
|
|
18
|
+
|
|
19
|
+
## How to Use
|
|
20
|
+
|
|
21
|
+
1. Read the command reference file to find the relevant command(s).
|
|
22
|
+
2. The reference contains:
|
|
23
|
+
- **Command Index** — table of all 414 commands with role and description
|
|
24
|
+
- **Command Details** — detailed syntax, parameters, and usage for each command
|
|
25
|
+
3. Commands are organized alphabetically. Use the index to find commands by description, or search the details for parameter syntax.
|
|
26
|
+
|
|
27
|
+
## Key Context
|
|
28
|
+
|
|
29
|
+
- The Crestron CLI uses a `MODEL>` prompt (e.g., `CP4>`, `MC4>`). It is **not** a standard Unix shell.
|
|
30
|
+
- Commands are case-insensitive but conventionally shown in mixed case (e.g., `ADDPUBKEYtouser`).
|
|
31
|
+
- Roles determine access level: Connect < Operator < Programmer < Administrator.
|
|
32
|
+
- Some commands return `ERROR:` when prerequisites aren't met (e.g., BACnet not running, AD not configured).
|
|
33
|
+
- Use `COMMAND ?` to get help for any command on a live processor.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
# ── Build sdist + wheel ────────────────────────────────────────────────
|
|
13
|
+
build-wheel:
|
|
14
|
+
name: Build wheel
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0 # setuptools-scm needs full history
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- run: pip install build
|
|
26
|
+
|
|
27
|
+
- run: python -m build
|
|
28
|
+
|
|
29
|
+
- uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
# ── Publish to PyPI (Trusted Publisher OIDC) ───────────────────────────
|
|
35
|
+
publish-pypi:
|
|
36
|
+
name: Publish to PyPI
|
|
37
|
+
needs: build-wheel
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
environment: pypi
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/download-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
name: dist
|
|
46
|
+
path: dist/
|
|
47
|
+
|
|
48
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
49
|
+
|
|
50
|
+
# ── Build standalone executables ───────────────────────────────────────
|
|
51
|
+
build-executables:
|
|
52
|
+
name: Build ${{ matrix.os }} executable
|
|
53
|
+
runs-on: ${{ matrix.os }}
|
|
54
|
+
strategy:
|
|
55
|
+
matrix:
|
|
56
|
+
include:
|
|
57
|
+
- os: macos-latest
|
|
58
|
+
artifact: crestron-setup-macos
|
|
59
|
+
binary: crestron-setup
|
|
60
|
+
- os: windows-latest
|
|
61
|
+
artifact: crestron-setup-windows
|
|
62
|
+
binary: crestron-setup.exe
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
with:
|
|
66
|
+
fetch-depth: 0
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: "3.12"
|
|
71
|
+
|
|
72
|
+
- name: Install dependencies
|
|
73
|
+
run: pip install . pyinstaller
|
|
74
|
+
|
|
75
|
+
- name: Build executable
|
|
76
|
+
run: >
|
|
77
|
+
pyinstaller
|
|
78
|
+
--onefile
|
|
79
|
+
--name crestron-setup
|
|
80
|
+
--collect-submodules crestron_setup
|
|
81
|
+
crestron_setup/__main__.py
|
|
82
|
+
|
|
83
|
+
- uses: actions/upload-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: ${{ matrix.artifact }}
|
|
86
|
+
path: dist/${{ matrix.binary }}
|
|
87
|
+
|
|
88
|
+
# ── Create GitHub Release ──────────────────────────────────────────────
|
|
89
|
+
github-release:
|
|
90
|
+
name: GitHub Release
|
|
91
|
+
needs: [build-executables, publish-pypi]
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
permissions:
|
|
94
|
+
contents: write
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/download-artifact@v4
|
|
97
|
+
with:
|
|
98
|
+
path: artifacts/
|
|
99
|
+
|
|
100
|
+
- name: Prepare release assets
|
|
101
|
+
run: |
|
|
102
|
+
mkdir release
|
|
103
|
+
cp artifacts/crestron-setup-macos/crestron-setup release/crestron-setup-macos
|
|
104
|
+
cp artifacts/crestron-setup-windows/crestron-setup.exe release/crestron-setup-windows.exe
|
|
105
|
+
cd release && sha256sum * > checksums.txt
|
|
106
|
+
|
|
107
|
+
- name: Create release
|
|
108
|
+
uses: softprops/action-gh-release@v2
|
|
109
|
+
with:
|
|
110
|
+
generate_release_notes: true
|
|
111
|
+
files: release/*
|
|
112
|
+
|
|
113
|
+
# ── Bump Homebrew formula ──────────────────────────────────────────────
|
|
114
|
+
bump-homebrew:
|
|
115
|
+
name: Update Homebrew tap
|
|
116
|
+
needs: github-release
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
steps:
|
|
119
|
+
- uses: mislav/bump-homebrew-formula-action@v3
|
|
120
|
+
with:
|
|
121
|
+
formula-name: crestron-setup
|
|
122
|
+
homebrew-tap: mikejobson/homebrew-tap
|
|
123
|
+
download-url: https://github.com/mikejobson/Crestron-Processor-Setup/releases/download/${{ github.ref_name }}/crestron-setup-macos
|
|
124
|
+
env:
|
|
125
|
+
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
Cross-platform Python CLI application for automated Crestron processor provisioning. Discovers devices via CIP protocol, manages accounts, configures settings, and handles firmware — all through an interactive terminal console. The legacy bash script (`setup_processor.sh`) is kept for reference.
|
|
6
|
+
|
|
7
|
+
The Crestron CLI is **not** a standard shell — it uses a custom `MODEL>` prompt (e.g., `CP4>`, `MC4>`). SSH automation uses paramiko's `invoke_shell()` with channel read/write, NOT `exec_command()`.
|
|
8
|
+
|
|
9
|
+
## Key Files
|
|
10
|
+
|
|
11
|
+
- `crestron_setup/` — Python package (the main application)
|
|
12
|
+
- `cli.py` — Interactive menu loop (main entry point)
|
|
13
|
+
- `discovery.py` — CIP device discovery (UDP broadcast on port 41794)
|
|
14
|
+
- `ssh.py` — SSH/SFTP via paramiko (`invoke_shell()` + prompt detection)
|
|
15
|
+
- `provisioning.py` — 5-phase setup logic (port of `setup_processor.sh`)
|
|
16
|
+
- `firmware.py` — Firmware download, version comparison, local file discovery
|
|
17
|
+
- `config.py` — YAML config loading/saving with platform-aware paths
|
|
18
|
+
- `models.py` — Data classes (`Device`, `Config`, `FirmwareSource`)
|
|
19
|
+
- `__main__.py` — Entry point for `python -m crestron_setup`
|
|
20
|
+
- `config.example.yaml` — Template configuration file
|
|
21
|
+
- `setup_processor.sh` — Legacy bash/expect script (macOS only)
|
|
22
|
+
- `crestron_command_reference.md` — 414-command CLI reference from a live CP4
|
|
23
|
+
- `example commands.txt` — Reference log of a manual setup session
|
|
24
|
+
|
|
25
|
+
## Architecture
|
|
26
|
+
|
|
27
|
+
### Python Application (`crestron_setup/`)
|
|
28
|
+
|
|
29
|
+
**Discovery**: `discovery.py` broadcasts a 266-byte CIP packet on UDP 41794, parses `0x15` responses to extract hostname, model, firmware version, and MAC address. Requires root/admin privileges.
|
|
30
|
+
|
|
31
|
+
**SSH**: `ssh.py` uses paramiko `invoke_shell()` with prompt detection via regex `[A-Za-z0-9-]+>`. The `CrestronSSH` class wraps connect/send_command/disconnect. `CrestronFirstBoot` handles the first-boot account creation flow (crestron/empty password → Username:/Password:/Verify prompts).
|
|
32
|
+
|
|
33
|
+
**Provisioning**: `provisioning.py` runs 5 sequential phases (same as the legacy bash script):
|
|
34
|
+
|
|
35
|
+
1. **Account Creation** — Detect first-boot, create admin account or verify existing
|
|
36
|
+
2. **Public Key Upload** — SFTP `.pub` to `/user/`
|
|
37
|
+
3. **Configuration** — 12 CLI commands (ADDPUBKEYTOUSER, TIMEZONE, TIMEDATE, SNTP, ports, lockout, FIPS, VER -V)
|
|
38
|
+
4. **Reboot** — Send REBOOT, poll ping + SSH (300s timeout)
|
|
39
|
+
5. **Firmware Upload** — Version comparison + SFTP `.puf` to `/firmware/`
|
|
40
|
+
|
|
41
|
+
**Firmware**: `firmware.py` downloads from per-model URLs configured in YAML, caches in `~/.cache/crestron-setup/firmware/`, falls back to a local firmware directory.
|
|
42
|
+
|
|
43
|
+
**Config**: `config.py` loads from `~/.config/crestron-setup/config.yaml` (macOS/Linux) or `%APPDATA%\crestron-setup\config.yaml` (Windows). A local `config.yaml` takes priority.
|
|
44
|
+
|
|
45
|
+
**CLI**: `cli.py` uses `rich` (tables, progress bars) and `questionary` (arrow-key menus, checkboxes, password prompts) for the interactive console.
|
|
46
|
+
|
|
47
|
+
## Conventions
|
|
48
|
+
|
|
49
|
+
- Status output uses rich markup: `[green][OK][/green]`, `[red][FAIL][/red]`, `[cyan][INFO][/cyan]`, `[yellow][WARN][/yellow]`
|
|
50
|
+
- Firmware filenames follow `{model_lower}_{version}.puf` (e.g., `mc4_2.8006.00284.01.puf`)
|
|
51
|
+
- PUF version from `VER -V` is used for firmware version comparison
|
|
52
|
+
- SSH connections use `look_for_keys=False, allow_agent=False` to force password auth
|
|
53
|
+
|
|
54
|
+
## Common Pitfalls
|
|
55
|
+
|
|
56
|
+
- Crestron SSH is NOT a standard shell — `exec_command()` will not work. Must use `invoke_shell()` with channel read/write and prompt regex matching.
|
|
57
|
+
- `VER -V` output has **leading whitespace** — don't anchor with `^` when parsing.
|
|
58
|
+
- The processor needs time after reboot before SFTP is ready (SSH may respond first). Firmware uploads happen **before** the reboot phase.
|
|
59
|
+
- Discovery requires root/admin for UDP broadcast on port 41794.
|
|
60
|
+
- First-boot detection: HTTPS check for `/createUser.html` redirect (fast) → SSH as `crestron` with empty password (fallback). If `Username:` prompt appears over SSH, it's first boot; if `MODEL>` prompt appears, it's already configured.
|
|
61
|
+
|
|
62
|
+
## Testing
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Create venv and install
|
|
66
|
+
python3 -m venv .venv
|
|
67
|
+
source .venv/bin/activate
|
|
68
|
+
pip install -e .
|
|
69
|
+
|
|
70
|
+
# Run the console
|
|
71
|
+
python -m crestron_setup
|
|
72
|
+
|
|
73
|
+
# Discovery requires sudo
|
|
74
|
+
sudo .venv/bin/python -m crestron_setup
|
|
75
|
+
|
|
76
|
+
# Legacy bash script (macOS only)
|
|
77
|
+
bash -n setup_processor.sh
|
|
78
|
+
./setup_processor.sh <hostname-or-ip>
|
|
79
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mike Jobson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crestron-setup
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Cross-platform Crestron processor provisioning console
|
|
5
|
+
Author-email: Mike Jobson <mike@mikejobson.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/mikejobson/Crestron-Processor-Setup
|
|
8
|
+
Project-URL: Repository, https://github.com/mikejobson/Crestron-Processor-Setup
|
|
9
|
+
Project-URL: Issues, https://github.com/mikejobson/Crestron-Processor-Setup/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: paramiko>=3.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: questionary>=2.0
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: httpx>=0.27
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Crestron Processor Setup
|
|
32
|
+
|
|
33
|
+
Cross-platform interactive console for Crestron processor provisioning. Discovers devices on the LAN, creates accounts, configures settings, and manages firmware — all from a terminal menu.
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- **Device Discovery** — CIP protocol broadcast (UDP 41794) finds Crestron processors on the local network, with first-boot detection
|
|
38
|
+
- **Interactive Console** — Arrow-key menus, checkbox device selection, progress bars
|
|
39
|
+
- **Cross-Platform** — Python + paramiko (works on macOS, Linux, and Windows — no `expect` dependency)
|
|
40
|
+
- **Firmware Management** — Download firmware from configurable URLs and upload to processors
|
|
41
|
+
- **5-Phase Provisioning**:
|
|
42
|
+
1. **Account Creation** — Detects first-boot state; creates admin account or verifies existing credentials
|
|
43
|
+
2. **Public Key Upload** — SFTP `.pub` key to `/user/`
|
|
44
|
+
3. **Configuration** — Timezone, NTP, web ports, login lockout policy, FIPS mode
|
|
45
|
+
4. **Firmware Upload** — Version comparison; uploads `.puf` to `/firmware/` only if newer
|
|
46
|
+
5. **Reboot** — Sends `REBOOT` and polls until back online
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
- Python 3.10+
|
|
51
|
+
- Root/admin privileges for device discovery (UDP broadcast)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python3 -m venv .venv
|
|
57
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
58
|
+
pip install -e .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Launch the interactive console
|
|
65
|
+
python -m crestron_setup
|
|
66
|
+
|
|
67
|
+
# Discovery requires elevated privileges
|
|
68
|
+
sudo .venv/bin/python -m crestron_setup
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The console presents a main menu with options to discover devices, set up a device by IP, download firmware, or edit settings.
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
Settings are stored in `~/.config/crestron-setup/config.yaml` (macOS/Linux) or `%APPDATA%\crestron-setup\config.yaml` (Windows). A local `config.yaml` in the working directory takes priority.
|
|
76
|
+
|
|
77
|
+
Copy `config.example.yaml` to get started. Key settings:
|
|
78
|
+
|
|
79
|
+
| Setting | Default | Description |
|
|
80
|
+
| ----------------- | -------------------------- | ----------------------------------- |
|
|
81
|
+
| `timezone` | `33` (GMT Standard Time) | Crestron timezone ID |
|
|
82
|
+
| `ntp_server` | `pool.ntp.org` | NTP server address |
|
|
83
|
+
| `pubkey_file` | `~/.ssh/id_rsa.pub` | SSH public key to upload |
|
|
84
|
+
| `firmware_dir` | `~/Sync/Crestron Firmware` | Local firmware directory (fallback) |
|
|
85
|
+
| `web_port` | `8080` | Web server port |
|
|
86
|
+
| `secure_web_port` | `8443` | Secure web server port |
|
|
87
|
+
| `firmware_urls` | _(empty)_ | Per-model firmware download URLs |
|
|
88
|
+
|
|
89
|
+
## Files
|
|
90
|
+
|
|
91
|
+
| Path | Purpose |
|
|
92
|
+
| ------------------------------- | ------------------------------------------------------------ |
|
|
93
|
+
| `crestron_setup/` | Python package — CLI, discovery, SSH, provisioning, firmware |
|
|
94
|
+
| `config.example.yaml` | Template configuration file |
|
|
95
|
+
| `setup_processor.sh` | Legacy bash script (macOS only, requires `expect`) |
|
|
96
|
+
| `crestron_command_reference.md` | CLI command reference (414 commands) from a live CP4 |
|
|
97
|
+
| `example commands.txt` | Reference log of a manual setup session |
|
|
98
|
+
|
|
99
|
+
## Legacy Bash Script
|
|
100
|
+
|
|
101
|
+
The original `setup_processor.sh` is still included for reference. It requires macOS with `expect` and takes a single hostname argument:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
./setup_processor.sh <hostname-or-ip>
|
|
105
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Crestron Processor Setup
|
|
2
|
+
|
|
3
|
+
Cross-platform interactive console for Crestron processor provisioning. Discovers devices on the LAN, creates accounts, configures settings, and manages firmware — all from a terminal menu.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Device Discovery** — CIP protocol broadcast (UDP 41794) finds Crestron processors on the local network, with first-boot detection
|
|
8
|
+
- **Interactive Console** — Arrow-key menus, checkbox device selection, progress bars
|
|
9
|
+
- **Cross-Platform** — Python + paramiko (works on macOS, Linux, and Windows — no `expect` dependency)
|
|
10
|
+
- **Firmware Management** — Download firmware from configurable URLs and upload to processors
|
|
11
|
+
- **5-Phase Provisioning**:
|
|
12
|
+
1. **Account Creation** — Detects first-boot state; creates admin account or verifies existing credentials
|
|
13
|
+
2. **Public Key Upload** — SFTP `.pub` key to `/user/`
|
|
14
|
+
3. **Configuration** — Timezone, NTP, web ports, login lockout policy, FIPS mode
|
|
15
|
+
4. **Firmware Upload** — Version comparison; uploads `.puf` to `/firmware/` only if newer
|
|
16
|
+
5. **Reboot** — Sends `REBOOT` and polls until back online
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Python 3.10+
|
|
21
|
+
- Root/admin privileges for device discovery (UDP broadcast)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 -m venv .venv
|
|
27
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
28
|
+
pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Launch the interactive console
|
|
35
|
+
python -m crestron_setup
|
|
36
|
+
|
|
37
|
+
# Discovery requires elevated privileges
|
|
38
|
+
sudo .venv/bin/python -m crestron_setup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The console presents a main menu with options to discover devices, set up a device by IP, download firmware, or edit settings.
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Settings are stored in `~/.config/crestron-setup/config.yaml` (macOS/Linux) or `%APPDATA%\crestron-setup\config.yaml` (Windows). A local `config.yaml` in the working directory takes priority.
|
|
46
|
+
|
|
47
|
+
Copy `config.example.yaml` to get started. Key settings:
|
|
48
|
+
|
|
49
|
+
| Setting | Default | Description |
|
|
50
|
+
| ----------------- | -------------------------- | ----------------------------------- |
|
|
51
|
+
| `timezone` | `33` (GMT Standard Time) | Crestron timezone ID |
|
|
52
|
+
| `ntp_server` | `pool.ntp.org` | NTP server address |
|
|
53
|
+
| `pubkey_file` | `~/.ssh/id_rsa.pub` | SSH public key to upload |
|
|
54
|
+
| `firmware_dir` | `~/Sync/Crestron Firmware` | Local firmware directory (fallback) |
|
|
55
|
+
| `web_port` | `8080` | Web server port |
|
|
56
|
+
| `secure_web_port` | `8443` | Secure web server port |
|
|
57
|
+
| `firmware_urls` | _(empty)_ | Per-model firmware download URLs |
|
|
58
|
+
|
|
59
|
+
## Files
|
|
60
|
+
|
|
61
|
+
| Path | Purpose |
|
|
62
|
+
| ------------------------------- | ------------------------------------------------------------ |
|
|
63
|
+
| `crestron_setup/` | Python package — CLI, discovery, SSH, provisioning, firmware |
|
|
64
|
+
| `config.example.yaml` | Template configuration file |
|
|
65
|
+
| `setup_processor.sh` | Legacy bash script (macOS only, requires `expect`) |
|
|
66
|
+
| `crestron_command_reference.md` | CLI command reference (414 commands) from a live CP4 |
|
|
67
|
+
| `example commands.txt` | Reference log of a manual setup session |
|
|
68
|
+
|
|
69
|
+
## Legacy Bash Script
|
|
70
|
+
|
|
71
|
+
The original `setup_processor.sh` is still included for reference. It requires macOS with `expect` and takes a single hostname argument:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
./setup_processor.sh <hostname-or-ip>
|
|
75
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Default configuration for Crestron processor setup.
|
|
2
|
+
# Copy to ~/.config/crestron-setup/config.yaml (macOS/Linux)
|
|
3
|
+
# or %APPDATA%\crestron-setup\config.yaml (Windows)
|
|
4
|
+
|
|
5
|
+
# Timezone ID to set on processors (use TIMEZONE LIST on a processor to see options)
|
|
6
|
+
timezone: "33" # 33 = GMT Standard Time
|
|
7
|
+
|
|
8
|
+
# NTP server for time synchronisation
|
|
9
|
+
ntp_server: "pool.ntp.org"
|
|
10
|
+
|
|
11
|
+
# SSH public key file to upload to processors
|
|
12
|
+
pubkey_file: "~/.ssh/id_rsa.pub"
|
|
13
|
+
|
|
14
|
+
# Local directory to search for .puf firmware files (fallback if no download URL)
|
|
15
|
+
firmware_dir: "~/Sync/Crestron Firmware"
|
|
16
|
+
|
|
17
|
+
# Web server ports
|
|
18
|
+
web_port: 8080
|
|
19
|
+
secure_web_port: 8443
|
|
20
|
+
|
|
21
|
+
# Login lockout policy
|
|
22
|
+
user_login_attempts: 5
|
|
23
|
+
user_lockout_time: "1m"
|
|
24
|
+
login_attempts: 20
|
|
25
|
+
lockout_time: "5m"
|
|
26
|
+
|
|
27
|
+
# FIPS mode (ON or OFF)
|
|
28
|
+
fips_mode: "OFF"
|
|
29
|
+
|
|
30
|
+
# Firmware download URLs per model.
|
|
31
|
+
# These are checked when running firmware updates. Leave empty or remove
|
|
32
|
+
# entries for models where you provide firmware files locally.
|
|
33
|
+
# Supports optional auth headers — see examples below.
|
|
34
|
+
firmware_urls:
|
|
35
|
+
# CP4:
|
|
36
|
+
# url: "https://example.com/firmware/cp4_latest.puf"
|
|
37
|
+
# headers:
|
|
38
|
+
# Authorization: "Bearer YOUR_TOKEN_HERE"
|
|
39
|
+
# MC4:
|
|
40
|
+
# url: "https://example.com/firmware/mc4_latest.puf"
|
|
41
|
+
# CP4N:
|
|
42
|
+
# url: "https://example.com/firmware/cp4n_latest.puf"
|
|
43
|
+
# RMC4:
|
|
44
|
+
# url: "https://example.com/firmware/rmc4_latest.puf"
|
|
45
|
+
|
|
46
|
+
# Discovery settings
|
|
47
|
+
discovery:
|
|
48
|
+
timeout: 5 # Seconds to listen for responses
|
|
49
|
+
broadcast_count: 3 # Number of broadcast packets to send
|