@ctrlpi/ctrlpi-lab 0.0.0-stage → 0.9.25

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.
@@ -0,0 +1,52 @@
1
+ <!-- PANE 2: Log Viewer Screen -->
2
+ <!-- PANE: Webhook Viewer -->
3
+ <div id="webhookPane" class="pane">
4
+ <div class="log-toolbar">
5
+ <div class="toolbar-left-group">
6
+ <span style="font-size:0.85rem;font-weight:600;color:var(--text-main);">Webhook Events</span>
7
+ <div class="log-icon-actions">
8
+ <button type="button" class="theme-toggle-btn" title="Refresh webhooks" aria-label="Refresh webhooks" onclick="triggerManualWebhookRefresh()">
9
+ <svg aria-hidden="true" id="webhookRefreshBtnIcon" viewBox="0 0 24 24">
10
+ <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>
11
+ </svg>
12
+ </button>
13
+ </div>
14
+ <div class="log-count-badge">
15
+ <span id="webhookCount">0</span> events
16
+ </div>
17
+ </div>
18
+ <div class="toolbar-right-group">
19
+ <div class="refresh-rate-group">
20
+ <label for="webhookPollSelect">Poll Rate:</label>
21
+ <select id="webhookPollSelect" class="refresh-rate-select" onchange="setupWebhookAutoRefresh()">
22
+ <option value="3000">3s</option>
23
+ <option value="10000">10s</option>
24
+ <option value="20000" selected>20s</option>
25
+ <option value="30000">30s</option>
26
+ <option value="manual">Manual</option>
27
+ </select>
28
+ </div>
29
+ <div class="config-input-group switch-group" style="border:none; padding:0; background:none;">
30
+ <label for="webhookAutoScrollToggle" style="margin-right: 6px;">Auto Scroll</label>
31
+ <label class="toggle-switch">
32
+ <input type="checkbox" id="webhookAutoScrollToggle" checked>
33
+ <span class="slider"></span>
34
+ </label>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ <div class="webhook-table-wrap">
39
+ <table class="webhook-table">
40
+ <thead>
41
+ <tr>
42
+ <th>Time (UTC)</th>
43
+ <th>Api-Key</th>
44
+ <th>Payload</th>
45
+ </tr>
46
+ </thead>
47
+ <tbody id="webhookTbody">
48
+ <tr><td colspan="3" id="webhookEmpty" style="text-align:center;color:var(--text-muted);padding:48px;">No webhook events yet.</td></tr>
49
+ </tbody>
50
+ </table>
51
+ </div>
52
+ </div>
@@ -0,0 +1,83 @@
1
+ <div id="welcomePanel" class="info-panel">
2
+ <div class="info-panel-header">
3
+ <span class="info-panel-title">Welcome to ctrlPi</span>
4
+ <button class="info-panel-close" onclick="closePinout()">Close</button>
5
+ </div>
6
+
7
+ <div class="info-section">
8
+ <h3>What is ctrlPi?</h3>
9
+ <p>ctrlPi lets you control Raspberry Pi and Pico W GPIO pins and read named sensors over a REST API, from a dashboard, command line, or integration.</p>
10
+ </div>
11
+
12
+ <div class="info-section">
13
+ <h3>Architecture</h3>
14
+ <div class="info-cards">
15
+ <div class="info-card">
16
+ <div class="info-card-title">Pi / Pico Agent</div>
17
+ <div class="info-card-desc">The Pi runs a Python FastAPI server with gpiozero; the Pico W / Pico 2 W runs a MicroPython server with machine.Pin. Both use port 8314 by default and the same REST API. API requests require an <code>Api-Key</code> header, except <code>/hello</code>.</div>
18
+ </div>
19
+ <div class="info-card">
20
+ <div class="info-card-title">ctrlpi-lab (this app)</div>
21
+ <div class="info-card-desc">Local browser dashboard for your ctrlPi setup: test GPIO and sensor endpoints, watch webhook events, and tail agent logs with zero dependencies.</div>
22
+ </div>
23
+ <div class="info-card">
24
+ <div class="info-card-title">Webhooks and integrations</div>
25
+ <div class="info-card-desc">Agents send watched-pin events to your webhook URL and configured bridge callbacks. The public ctrlpi.com webhook test feed is for setup and debugging; MCP and smart-home bridges connect separately to the agents.</div>
26
+ </div>
27
+ </div>
28
+ </div>
29
+
30
+ <div class="info-section">
31
+ <h3>Key capabilities</h3>
32
+ <ul>
33
+ <li>Read and write GPIO pins by number or configured name alias</li>
34
+ <li>Configure pins as input, output, VCC (always HIGH), or GND (always LOW)</li>
35
+ <li>Timed output pulses with automatic revert: <code>duration</code> is capped by <code>max</code>; when duration is omitted, a configured max supplies it</li>
36
+ <li>Active-low (reversed) logic, with logical value and physical level reported separately</li>
37
+ <li>Watch inputs for state changes and outputs for writes; send events to configured webhook and bridge targets, or log them when no target is configured</li>
38
+ <li>Read named sensors on demand using scripts: shell scripts on Pi, MicroPython scripts on Pico</li>
39
+ <li>Read, update, and load configuration, with automatic backups before updates and loads</li>
40
+ </ul>
41
+ </div>
42
+
43
+ <div class="info-section">
44
+ <h3>Quick start</h3>
45
+ <p>Install an agent using the instructions below. In the header, select a discovered agent or click <strong>+</strong> to add its IP address or hostname, port (default <strong>8314</strong>), and API key. Use the key icon to edit the saved key, then explore endpoints in the <strong>API</strong> tab or open <strong>API - cURL Examples</strong>.</p>
46
+ <p>The agents serve plain HTTP. Keep them on a trusted LAN; use a tunnel for remote access rather than exposing port 8314 to the internet.</p>
47
+ </div>
48
+
49
+ <div class="info-section">
50
+ <h3>Install the API on a Raspberry Pi</h3>
51
+ <p>Requires Python 3.9+ on Raspberry Pi OS. Supported boards: Raspberry Pi 2, 3, 4, 5, Zero W, and Zero 2 W. Run these commands in a terminal on the Pi.</p>
52
+ <p><strong>Recommended: install with curl</strong></p>
53
+ <div class="info-code-block">curl -fsSL https://raw.githubusercontent.com/ctrlpi/pi-gpio-api/main/install.sh | bash
54
+ cd pi-gpio-api
55
+ ./run.sh</div>
56
+ <p>The installer downloads the project, builds its virtual environment, and asks for an agent name and API key if no config exists. The server listens on all interfaces at port 8314 by default.</p>
57
+ <p><strong>Alternative: clone with git</strong></p>
58
+ <div class="info-code-block">git clone https://github.com/ctrlpi/pi-gpio-api.git
59
+ cd pi-gpio-api
60
+ ./install.sh
61
+ ./run.sh</div>
62
+ <p>To run at boot, copy the ready-to-paste systemd command printed by the installer. To change and save the API key when starting the server:</p>
63
+ <div class="info-code-block">./run.sh --api-key your-secret-key --save</div>
64
+ <p>See the <a href="https://github.com/ctrlpi/pi-gpio-api#install-on-your-pi" target="_blank" rel="noopener noreferrer">Pi API installation guide</a> for GPIO backend requirements and more options.</p>
65
+ </div>
66
+
67
+ <div class="info-section">
68
+ <h3>Install the API on a Raspberry Pi Pico</h3>
69
+ <p>Requires a <strong>Pico W or Pico 2 W</strong>, MicroPython firmware, and a Mac/PC connected to the board over USB. Run the tools below on your computer, not on the Pico.</p>
70
+ <p><strong>Easiest: Pico Bay</strong></p>
71
+ <div class="info-code-block">npx @ctrlpi/pico-bay</div>
72
+ <p>Connect your board and choose <strong>Install ctrlPi API</strong> from the top-right menu. Enter your API key and WiFi information when prompted. Pico Bay can also install MicroPython when the board is connected in BOOTSEL mode, or after choosing <strong>Reboot to BOOTSEL</strong>.</p>
73
+ <p><strong>Alternative: install with curl</strong></p>
74
+ <div class="info-code-block">curl -fsSL https://raw.githubusercontent.com/ctrlpi/pico-gpio-api/main/install.sh | bash</div>
75
+ <p>With MicroPython already installed, the installer asks for any missing API key, agent name, and WiFi credentials, copies the files to every connected Pico over USB using mpremote, and resets the boards. Existing device configuration is preserved on a normal reinstall.</p>
76
+ <p><strong>Alternative: clone with git</strong></p>
77
+ <div class="info-code-block">git clone https://github.com/ctrlpi/pico-gpio-api.git
78
+ cd pico-gpio-api
79
+ ./install.sh</div>
80
+ <p>The API starts automatically at every boot on port 8314. The original Pico W requires an <code>http://</code> webhook target; Pico 2 W also supports <code>https://</code>.</p>
81
+ <p>See the <a href="https://github.com/ctrlpi/pico-gpio-api#install-on-your-pico-w" target="_blank" rel="noopener noreferrer">Pico API installation guide</a> for firmware, WiFi, and USB deployment details.</p>
82
+ </div>
83
+ </div>