Files
SolarManager/startWattpilotMQTT.sh
T
adminandClaude Opus 5 79843aa2ae SolarManager unter Versionsverwaltung
Erster Stand der Hintergrundprozesse, die auf der Synology unter
/volume1/homes/wagner/SolarManager laufen: der Manager selbst, die Sammler
je Geraet, die MQTT-Bruecke, der Wecker und - neu hinzugezogen - der
AutoAction-Runner, der als Hintergrundprozess hierher gehoert und nicht ins
Web-Verzeichnis.

Zugangsdaten stehen nicht mehr im Quelltext, sondern in config.ini, die
nicht mit eingecheckt wird. Vorlage ist config.ini.example, gelesen wird sie
von konfig.py. Betroffen waren solarManager.py (Datenbank und Wattpilot),
zeit.py, gatherWaterData.py, wecker.py und skoda_testdaten.py, das sich das
Passwort bisher aus dem Quelltext eines anderen Moduls herausgesucht hat.

Die Kia-Anbindung ist mit dem Fahrzeug entfallen: kiaTest.py,
gatherCarData.py und hyundai_kia_connect_api sind nicht mehr dabei, ebenso
gatherInverterData.py, auf das nur noch eine auskommentierte Zeile zeigte.

Die mitgelieferten Bibliotheken bleiben im Repository - die NAS hat kein
pip, sie muessen neben den Skripten liegen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 20:46:59 +02:00

46 lines
1.3 KiB
Bash

#!/bin/bash
# Startet die Wattpilot-Bruecke (wattpilotshell) neu.
#
# Zugangsdaten kommen aus config.ini und stehen nicht mehr hier im Skript -
# frueher stand das Wattpilot-Passwort im Klartext in der ersten Zeile.
BASIS="/volume1/homes/wagner/SolarManager"
# Einen Wert aus config.ini lesen: konf <abschnitt> <schluessel>
konf() {
awk -v abschnitt="[$1]" -v schluessel="$2" '
$0 == abschnitt { drin = 1; next }
/^\[/ { drin = 0 }
drin && $0 ~ "^" schluessel " *=" { sub(/^[^=]*= */, ""); print; exit }
' "$BASIS/config.ini"
}
export MQTT_ENABLED=true
export MQTT_HOST=$(konf wattpilot mqtt_host)
export WATTPILOT_HOST=$(konf wattpilot host)
export WATTPILOT_PASSWORD=$(konf wattpilot password)
if [ -z "$WATTPILOT_PASSWORD" ]; then
echo "config.ini: [wattpilot] password fehlt - Abbruch"
exit 1
fi
echo "Starting..."
# Change the name of the script here
SCRIPT_NAME="wattpilotshell"
LOG_FILE="wattpilotshell.log"
# Find the process ID of any running instance of the script
PID=$(ps aux | grep "$SCRIPT_NAME" | grep -v grep | awk '{print $2}')
# If a running instance was found, kill it
if [[ -n "$PID" ]]; then
echo "Killing process $PID"
kill $PID
fi
# Start the script
cd "$BASIS"
/var/services/homes/wagner/.local/bin/wattpilotshell server &> "$LOG_FILE" &