Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit ce6a310

Browse files
authored
Merge pull request #16 from Stolas/copilot/collect-all-open-issues-fixes
Fix all open issues: dead link, CompreFace, syslog support, NVR in Grafana Cant be asked to check lets roll it.
2 parents 2e8579c + 537e267 commit ce6a310

File tree

5 files changed

+386
-48
lines changed

5 files changed

+386
-48
lines changed

README.md

Lines changed: 182 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,18 @@ This project was 99% developed by AI assistants (Gemini and GitHub Copilot). The
5050

5151
* **Local Network Access:** All services communicate on the local network
5252
* **Port Availability:** Ensure the following ports are available:
53+
* 514 (Syslog UDP/TCP for Node-RED) - for log ingestion from network devices (Fixes #14)
54+
* 1880 (Node-RED, configurable)
5355
* 1883 (Mosquitto MQTT)
56+
* 1984 (go2rtc Web UI) - for RTSP stream conversion (Fixes #15)
5457
* 3000 (Grafana)
5558
* 3001 (Double-Take) - only if NVR is enabled
5659
* 5000 (Frigate, configurable) - only if NVR is enabled
60+
* 8000 (CompreFace) - only if NVR is enabled (Fixes #5)
5761
* 8080 (Zigbee2MQTT Web UI)
5862
* 8086 (InfluxDB)
59-
* 1880 (Node-RED, configurable)
63+
* 8554 (go2rtc RTSP server) - for re-streaming camera feeds (Fixes #15)
64+
* 8555 (go2rtc WebRTC server) - for low-latency browser playback (Fixes #15)
6065

6166
## Getting Started
6267

@@ -119,6 +124,34 @@ If you selected the NVR option, you need to configure Frigate:
119124

120125
* Edit the `frigate_config.yml` file to define your cameras and settings.
121126

127+
### 3a. Configure CompreFace and Double-Take (NVR Only - Fixes #5)
128+
129+
CompreFace provides face recognition capabilities for Double-Take, enabling facial detection in your NVR setup.
130+
131+
**Automatic Configuration:**
132+
133+
The `COMPREFACE_API_KEY` is automatically generated by `create_secrets.sh`. This key is used for secure communication between Double-Take and CompreFace.
134+
135+
**Double-Take Configuration:**
136+
137+
After the stack is running, configure Double-Take to use CompreFace:
138+
139+
1. Access Double-Take at `http://doubletake.<BASE_DOMAIN>` or `http://<host_ip>:3001`
140+
2. Navigate to Settings → Detectors
141+
3. Add CompreFace as a detector with:
142+
- **URL:** `http://compreface:8000`
143+
- **API Key:** Use the `COMPREFACE_API_KEY` from your `secrets.env` file
144+
4. Configure face recognition settings as needed
145+
146+
**CompreFace Face Training:**
147+
148+
To train CompreFace to recognize faces:
149+
150+
1. Access CompreFace at `http://compreface.<BASE_DOMAIN>` or `http://<host_ip>:8000`
151+
2. Create a new application or use the existing one
152+
3. Upload reference images for face recognition
153+
4. Double-Take will automatically use these trained faces for detection
154+
122155
### 4. Run the Stack
123156

124157
After completing the manual configuration in `secrets.env`, run the setup again:
@@ -416,14 +449,135 @@ For more information on Grafana security and sharing options, refer to the [offi
416449
- The Grafana UI will show a "Sign in" button in the top right for anonymous users
417450
- Admin users can still log in to create/edit dashboards
418451

452+
## Node-RED Configuration (Fixes #14)
453+
454+
Node-RED provides flow-based automation for the IoT/SCADA stack. It includes support for MQTT and syslog ingestion.
455+
456+
### MQTT Integration
457+
458+
Node-RED can communicate with the Mosquitto MQTT broker on the internal network. To configure MQTT in your flows:
459+
460+
1. Add an **mqtt in** or **mqtt out** node to your flow
461+
2. Configure the broker connection:
462+
- **Server:** `mosquitto` (internal container hostname)
463+
- **Port:** `1883`
464+
- **Username:** Your `MQTT_USER` from `secrets.env`
465+
- **Password:** Your `MQTT_PASSWORD` from `secrets.env`
466+
467+
**Example MQTT Flow:**
468+
```json
469+
[{"id":"mqtt-broker","type":"mqtt-broker","name":"Mosquitto","broker":"mosquitto","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true}]
470+
```
471+
472+
### Syslog Log Ingestion
473+
474+
The stack exposes port 514 (UDP and TCP) for syslog log ingestion. This allows network devices (routers, switches, servers, etc.) to send logs to Node-RED for processing, aggregation, and visualization.
475+
476+
**Installing node-red-contrib-syslog-input:**
477+
478+
1. Access Node-RED at `http://nodered.<BASE_DOMAIN>` or `http://<host_ip>:1880`
479+
2. Go to **Menu → Manage palette → Install**
480+
3. Search for `node-red-contrib-syslog-input`
481+
4. Click **Install**
482+
483+
**Setting up Syslog Input Flow:**
484+
485+
1. Add a **syslog input** node to your flow
486+
2. Configure the node:
487+
- **Port:** `514`
488+
- **Protocol:** `UDP` or `TCP` (depending on your device configuration)
489+
3. Connect to processing nodes (function, debug, dashboard, etc.)
490+
491+
**Example Syslog Flow:**
492+
```json
493+
[{"id":"syslog-in","type":"syslog-input","name":"Syslog Input","port":"514","protocol":"udp","wires":[["debug-node"]]},{"id":"debug-node","type":"debug","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto"}]
494+
```
495+
496+
**Configuring Network Devices:**
497+
498+
Configure your network devices to send syslog messages to the Home-IOT-SCADA-Stack host IP address on port 514. Refer to your device's documentation for specific syslog configuration instructions.
499+
500+
## go2rtc and Camera Streams in Grafana (Fixes #15)
501+
502+
go2rtc is included in all stack profiles (IoT/SCADA, NVR, and combined) to enable displaying camera RTSP streams in Grafana dashboards.
503+
504+
### go2rtc Configuration
505+
506+
1. Access go2rtc at `http://go2rtc.<BASE_DOMAIN>` or `http://<host_ip>:1984`
507+
2. Configure your camera streams in the go2rtc web interface or by creating a config file
508+
509+
**Example go2rtc configuration (create in the go2rtc_data volume):**
510+
```yaml
511+
streams:
512+
camera1:
513+
- rtsp://user:[email protected]:554/stream1
514+
camera2:
515+
- rtsp://user:[email protected]:554/stream1
516+
```
517+
518+
### Available go2rtc Ports
519+
520+
* **Port 1984:** go2rtc Web UI and API
521+
* **Port 8554:** RTSP server (re-streams converted streams)
522+
* **Port 8555:** WebRTC server (for browser playback)
523+
524+
### Embedding Camera Streams in Grafana
525+
526+
To display camera streams in Grafana dashboards:
527+
528+
1. **Install the HTML panel plugin:**
529+
- Go to Grafana → Configuration → Plugins
530+
- Search for "HTML" or "Text" panel
531+
- Install a suitable HTML panel plugin (e.g., "marcusolsson-dynamictext-panel")
532+
533+
2. **Create a dashboard panel with embedded stream:**
534+
```html
535+
<iframe
536+
src="http://go2rtc.<BASE_DOMAIN>/stream.html?src=camera1"
537+
width="100%"
538+
height="400"
539+
frameborder="0">
540+
</iframe>
541+
```
542+
543+
3. **Alternative: Use WebRTC stream URL:**
544+
```
545+
http://go2rtc.<BASE_DOMAIN>/api/ws?src=camera1
546+
```
547+
548+
**Example Grafana Dashboard JSON:**
549+
```json
550+
{
551+
"panels": [
552+
{
553+
"title": "Camera 1",
554+
"type": "marcusolsson-dynamictext-panel",
555+
"options": {
556+
"content": "<iframe src='http://go2rtc.home.local/stream.html?src=camera1' width='100%' height='400' frameborder='0'></iframe>"
557+
}
558+
}
559+
]
560+
}
561+
```
562+
563+
### Stream URLs Reference
564+
565+
| Format | URL Pattern | Use Case |
566+
|--------|-------------|----------|
567+
| WebRTC | `http://go2rtc:1984/stream.html?src=<stream_name>` | Low latency browser playback |
568+
| HLS | `http://go2rtc:1984/api/stream.m3u8?src=<stream_name>` | Wide compatibility |
569+
| RTSP | `rtsp://go2rtc:8554/<stream_name>` | Re-stream to other applications |
570+
419571
## Components and Access Points
420572

421573
| Component | Purpose | Access URL (Default Ports) | Notes |
422574
|-----------|---------|----------------------------|-------|
423575
| **Nginx** | Reverse Proxy | http://&lt;host_ip&gt; | Always included, provides hostname-based routing |
424576
| **Grafana** | Data Visualization (SCADA UI) | http://grafana.&lt;BASE_DOMAIN&gt; or :3000 | IoT/SCADA modes only |
577+
| **go2rtc** | RTSP to WebRTC/HLS Converter | http://go2rtc.&lt;BASE_DOMAIN&gt; or :1984 | All modes, for camera streams in Grafana (Fixes #15) |
425578
| **Frigate** | NVR and Object Detection | http://frigate.&lt;BASE_DOMAIN&gt; or :5000 | NVR modes only |
426579
| **Double-Take** | Facial Recognition for Frigate | http://doubletake.&lt;BASE_DOMAIN&gt; or :3001 | NVR modes only |
580+
| **CompreFace** | Face Recognition API | http://compreface.&lt;BASE_DOMAIN&gt; or :8000 | NVR modes only, backend for Double-Take (Fixes #5) |
427581
| **Node-RED** | Flow-Based Automation | http://nodered.&lt;BASE_DOMAIN&gt; or :1880 | IoT/SCADA modes only |
428582
| **Zigbee2MQTT** | Zigbee Device Control | http://zigbee.&lt;BASE_DOMAIN&gt; or :8080 | IoT/SCADA modes only |
429583
| **Cockpit** | openSUSE Web Console | http://cockpit.&lt;BASE_DOMAIN&gt; | Requires Cockpit enabled on host |
@@ -453,6 +607,33 @@ sudo systemctl enable --now cockpit.socket
453607
| **nginx/** | Directory for Nginx configuration files. nginx.conf is auto-generated based on stack type. |
454608
| **.gitignore** | Ensures secrets.env and .stack_config are never committed to Git. |
455609

610+
## Security
611+
612+
This stack implements multiple security layers to protect your home IoT infrastructure:
613+
614+
### Credential Management
615+
* **Automatic Secret Generation:** The `create_secrets.sh` script generates unique, random, 64-character passwords/tokens for all sensitive environment variables (MQTT, InfluxDB, Grafana, SMB).
616+
* **Secrets File Protection:** The `secrets.env` file is excluded from version control via `.gitignore` to prevent accidental credential exposure.
617+
618+
### Network Security
619+
* **Container Isolation:** All services run in isolated Podman containers on a dedicated internal network (`iot_net`).
620+
* **Hostname-Based Routing:** Nginx reverse proxy provides hostname-based access to services, reducing direct port exposure.
621+
* **Rootless Containers:** The stack is designed to run with rootless Podman for enhanced security isolation.
622+
623+
### Access Control
624+
* **Grafana Authentication:** By default, Grafana requires authentication. Anonymous access can be optionally enabled for trusted networks only.
625+
* **MQTT Authentication:** Mosquitto broker supports username/password authentication for MQTT clients.
626+
* **Service Segmentation:** Services are organized by stack type (IoT/SCADA, NVR) allowing deployment of only necessary components.
627+
628+
### Best Practices
629+
* Keep your `secrets.env` file secure and never commit it to version control.
630+
* Regularly update container images for security patches.
631+
* Use network-level security (firewall, VPN) to restrict external access.
632+
* Review Grafana dashboard permissions when enabling public access.
633+
* Monitor container logs for suspicious activity.
634+
635+
For more information on specific service security configurations, see the [Grafana Configuration](#grafana-configuration) section.
636+
456637
## Troubleshooting
457638

458639
* **openSUSE Leap Micro Updates:** Use `sudo transactional-update` for package management and system upgrades, followed by a reboot.

create_secrets.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ sed -e "
4141
/^INFLUXDB_ADMIN_TOKEN=/c\INFLUXDB_ADMIN_TOKEN=$(generate_random_string)
4242
/^GRAFANA_ADMIN_PASSWORD=/c\GRAFANA_ADMIN_PASSWORD=$(generate_random_string)
4343
/^GRAFANA_SECRET_KEY=/c\GRAFANA_SECRET_KEY=$(generate_random_string)
44+
/^COMPREFACE_API_KEY=/c\COMPREFACE_API_KEY=$(generate_random_string)
4445
/^SMB_PASS=/c\SMB_PASS=$(generate_random_string)
4546
" "$ENV_EXAMPLE_FILE" > "$TEMP_FILE"
4647

nginx/index.html.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<div class="info-card">
4545
<h3>🛡️ Security</h3>
4646
<p>Powered by Podman with automatic secret generation and hostname-based routing</p>
47-
<a href="https://github.com/Stolas/Home-IOT-SCADA-Stack#features" target="_blank" class="doc-link">Security Details</a>
47+
<a href="https://github.com/Stolas/Home-IOT-SCADA-Stack#security" target="_blank" class="doc-link">Security Details</a>
4848
</div>
4949
</section>
5050
</main>

secrets.env-example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,22 @@ ZIGBEE2MQTT_HOSTNAME=zigbee
7777
COCKPIT_HOSTNAME=cockpit
7878
DOUBLETAKE_HOSTNAME=doubletake
7979

80+
# GO2RTC CONFIGURATION (RTSP to WebRTC/HLS converter for Grafana) - Fixes #15
81+
# go2rtc allows displaying camera RTSP streams in Grafana dashboards
82+
# Available for all stack profiles (IoT/SCADA, NVR, and combined)
83+
GO2RTC_HOSTNAME=go2rtc
84+
8085
# FRIGATE CONFIGURATION
8186
FRIGATE_PORT=5000
8287
FRIGATE_RTSP_PORT=8554
8388
FRIGATE_RECORDINGS_HOST_PATH=/home/stolas/frigate_recordings
8489

90+
# COMPREFACE CONFIGURATION (Face Recognition API for Double-Take) - Fixes #5
91+
# CompreFace provides facial recognition capabilities for Double-Take
92+
# Generate a unique API key for secure communication between Double-Take and CompreFace
93+
COMPREFACE_API_KEY=your_compreface_api_key
94+
COMPREFACE_HOSTNAME=compreface
95+
8596
# SMB CONFIGURATION
8697
SMB_SERVER=my.smbserver.home
8798
SMB_SHARE=frigate_share

0 commit comments

Comments
 (0)