Files
bigbrother/presence/install.sh
T
Cobra fd014b2a38 Add passive presence daemon — multi-signal WiFi/ARP/DHCP/BLE with exponential decay
Implements DevTrack #530: Person Presence Intelligence daemon for BigBrother drop implant.

Core components:
- presence_daemon.py: 4 sensor threads (probe, ARP, DHCP, BLE) with exponential decay
- presence_schema.sql: SQLite schema for persons, devices, signals, occupancy log
- install.sh: Deployment script (copies to /opt/sensor/, creates systemd service)
- AUDIT_impl.md: Implementation notes, limitations, audit checklist

Features:
- Exponential decay model (lambda=0.08/min) for signal certainty
- Presence anchor (45-min hold time prevents false VACANT)
- Person state machine: UNKNOWN → PRESENT ↔ ABSENT
- Multi-signal fusion: max + 0.08×min for device aggregate
- Thread-safe in-memory state with SQLite persistence
- Matrix webhook alerting (if configured)
- HTTP status endpoint on 127.0.0.1:9191
- Graceful BLE degrade if bleak unavailable
- No tool fingerprints in output or service names
2026-04-10 15:49:03 -04:00

47 lines
1.0 KiB
Bash

#!/bin/bash
# Install script for presence daemon
# Deploys sensor.py and service configuration to /opt/sensor/
set -e
echo "Installing presence daemon..."
# Create sensor directory
sudo mkdir -p /opt/sensor
sudo chown $USER:$USER /opt/sensor
# Copy daemon and schema
cp presence_daemon.py /opt/sensor/sensor.py
cp presence_schema.sql /opt/sensor/
chmod +x /opt/sensor/sensor.py
echo "Created /opt/sensor/sensor.py and schema"
# Create systemd service
sudo tee /etc/systemd/system/sensor.service > /dev/null << 'EOF'
[Unit]
Description=Network Sensor
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /opt/sensor/sensor.py
Restart=on-failure
RestartSec=10
Environment=PRESENCE_DB_PATH=/opt/sensor/sensor.db
[Install]
WantedBy=multi-user.target
EOF
echo "Created /etc/systemd/system/sensor.service"
# Reload systemd and enable service
sudo systemctl daemon-reload
sudo systemctl enable sensor
sudo systemctl start sensor
echo "Enabled and started sensor service"
echo "Status:"
sudo systemctl status sensor --no-pager | head -20