Files
retr0 391e615893 Feature: ShineDiag — portabler Vor-Ort-Diagnose-Gateway (Pi 3B)
Flask-App + mobile Web UI für Diagnose vor Ort ohne HAOS/MQTT.
Pi 3B: eth0 → ShineLAN-X (DHCP), wlan0 → Hotspot "ShineDiag".
Browser auf http://10.0.1.1: Modell wählen, alle Sensoren auslesen,
Rohdaten-Register-Dump, Export als JSON.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 11:50:53 +02:00

70 lines
1.5 KiB
Bash

#!/bin/bash
# ShineDiag Pi 3B Setup — einmalig als root ausführen
set -e
echo "=== ShineDiag Installation ==="
# Pakete
apt-get update -q
apt-get install -y python3-pip hostapd dnsmasq
# Python-Abhängigkeiten
pip3 install flask pymodbus --break-system-packages
# Netzwerk: eth0 statische IP
cat setup/dhcpcd.conf >> /etc/dhcpcd.conf
# DHCP-Server für eth0
cp setup/dnsmasq.conf /etc/dnsmasq.conf
systemctl enable dnsmasq
# WiFi-Hotspot
cp setup/hostapd.conf /etc/hostapd/hostapd.conf
echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' >> /etc/default/hostapd
systemctl unmask hostapd
systemctl enable hostapd
# Wlan0 IP
cat >> /etc/dhcpcd.conf << 'EOF'
interface wlan0
static ip_address=10.0.1.1/24
nohook wpa_supplicant
EOF
# DHCP auch für wlan0 (MacBook-Verbindung)
cat >> /etc/dnsmasq.conf << 'EOF'
interface=wlan0
dhcp-range=10.0.1.100,10.0.1.200,1h
EOF
# systemd-Service für ShineDiag
INSTALL_DIR="$(pwd)"
cat > /etc/systemd/system/shinediag.service << EOF
[Unit]
Description=ShineDiag Diagnose-Tool
After=network.target
[Service]
ExecStart=/usr/bin/python3 ${INSTALL_DIR}/diagnose.py
WorkingDirectory=${INSTALL_DIR}
Environment=PORT=80
Environment=SHINELANX_IP=10.0.0.100
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable shinediag
echo ""
echo "=== Fertig! Bitte neu starten: sudo reboot ==="
echo ""
echo "Nach dem Neustart:"
echo " WiFi: 'ShineDiag' | Passwort: shinelanx"
echo " Browser: http://10.0.1.1"