feat: Auto-detection inverter paralleli con script dedicati
Build Docker Image for Raspberry Pi / build-and-push (push) Successful in 7m18s

- Modificato entrypoint.sh per rilevare automaticamente inverter paralleli
- Usa flag -p per parallel discovery (testa QPGS0-9)
- Script mqtt-push-parallel.sh per pubblicare dati di ogni inverter
- Script mqtt-init-parallel.sh per discovery topics (ogni 10 min)
- Naming: voltronic_inv1, voltronic_inv2, ecc.
- Fallback automatico a single-mode se PARALLEL_COUNT=0

Nota: Il parallel discovery richiede che inverter supportino comandi QPGS
This commit is contained in:
Pi Developer
2026-02-02 23:24:49 +01:00
parent 53899b0fac
commit dc5bd07438
2 changed files with 117 additions and 5 deletions
+27 -5
View File
@@ -235,16 +235,38 @@ if [ "$NEED_DISCOVERY" = "true" ]; then
fi
echo ""
echo "=== Starting MQTT Bridge Services ==="
echo "=== Detecting Inverter Configuration ==="
echo ""
# Wait a bit for the device to be ready
sleep 2
# Init the mqtt server for the first time, then every 5 minutes
# Check for parallel inverters
PARALLEL_CHECK=$(/opt/inverter-cli/bin/inverter_poller -p 2>&1)
PARALLEL_COUNT=$(echo "$PARALLEL_CHECK" | grep "PARALLEL_COUNT=" | cut -d= -f2)
if [ ! -z "$PARALLEL_COUNT" ] && [ "$PARALLEL_COUNT" -gt 0 ]; then
echo "✓ Detected $PARALLEL_COUNT parallel inverter(s)"
echo " Using parallel mode scripts..."
USE_PARALLEL=true
MQTT_PUSH_SCRIPT="/opt/inverter-mqtt/mqtt-push-parallel.sh"
MQTT_INIT_SCRIPT="/opt/inverter-mqtt/mqtt-init-parallel.sh"
else
echo " Single inverter mode"
echo " Using standard scripts..."
USE_PARALLEL=false
MQTT_PUSH_SCRIPT="/opt/inverter-mqtt/mqtt-push.sh"
MQTT_INIT_SCRIPT="/opt/inverter-mqtt/mqtt-init.sh"
fi
echo ""
echo "=== Starting MQTT Bridge Services ==="
echo ""
# Init the mqtt server for the first time, then every 10 minutes (600 seconds)
# This will re-create the auto-created topics in the MQTT server if HA is restarted...
echo "Starting MQTT initialization service..."
watch -n 300 /opt/inverter-mqtt/mqtt-init.sh > /dev/null 2>&1 &
echo "Starting MQTT initialization service (every 10 minutes)..."
watch -n 600 "$MQTT_INIT_SCRIPT" > /dev/null 2>&1 &
# Run the MQTT Subscriber process in the background (so that way we can change the configuration on the inverter from home assistant)
echo "Starting MQTT subscriber for commands..."
@@ -257,4 +279,4 @@ echo "✓ All services started successfully!"
echo " Logs will appear below..."
echo ""
watch -n 30 /opt/inverter-mqtt/mqtt-push.sh > /dev/null 2>&1
watch -n 30 "$MQTT_PUSH_SCRIPT" > /dev/null 2>&1