Implementazione supporto multi-inverter paralleli e fix comunicazione MQTT
Build Docker Image for Raspberry Pi / build-and-push (push) Failing after 1m15s
Build Docker Image for Raspberry Pi / build-and-push (push) Failing after 1m15s
- Aggiunto supporto lettura inverter paralleli tramite comandi QPGS0-QPGS9 - Implementato discovery automatico inverter con filtro duplicati e serial invalidi - Risolti bug critici comunicazione seriale: * Fix buffer ExecuteCmd da 7 a 200 bytes * Supporto terminatori CR e LF * Modalità blocking con delay 500ms * Lettura byte-by-byte per terminatore affidabile - Implementato script MQTT per pubblicazione dati multi-inverter: * mqtt-push-parallel.sh con topic separati per ogni inverter * Fix autenticazione MQTT con username/password * Aggiunto flag retain (-r) per persistenza dati - Creato test-loop-parallel.sh per simulazione completa container - Aggiornata documentazione con compatibilità MKS IV e guida test loop - Aggiornati profili debug VS Code per bash e parallel discovery - Configurazione MQTT completa con server reale (192.168.1.37:1883) Sistema testato e funzionante con 2 inverter Voltronic Axpert MKS IV
This commit is contained in:
@@ -0,0 +1,439 @@
|
||||
# Test Comandi Voltronic Axpert MKS IV - Risultati Completi
|
||||
|
||||
**Data:** 31 Gennaio 2026
|
||||
**Device:** Voltronic Axpert MKS IV
|
||||
**Connessione:** RS232 via FTDI USB-Serial (`/dev/ttyUSB0`)
|
||||
**Baudrate:** 2400 baud, 8N1
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Obiettivo Test
|
||||
|
||||
Identificare quali comandi del protocollo Voltronic (P17/P18) sono supportati dal MKS IV per trovare alternative ai comandi standard (QPIGS, QPIRI, QMOD, QPIWS) che rispondono NAK.
|
||||
|
||||
---
|
||||
|
||||
## 📊 Risultati Sintetici
|
||||
|
||||
| Categoria | Totale Testati | Funzionanti | NAK | Timeout |
|
||||
|-----------|----------------|-------------|-----|---------|
|
||||
| **Comandi Standard** | 4 | 0 | 4 | 0 |
|
||||
| **Comandi P18** | 5 | 1 | 0 | 4 |
|
||||
| **Comandi Avanzati** | 6 | 0 | 0 | 6 |
|
||||
| **Comandi Batteria** | 2 | 0 | 0 | 2 |
|
||||
| **Comandi Diagnostici** | 5 | 0 | 3 | 2 |
|
||||
| **TOTALE** | **22** | **1** | **7** | **14** |
|
||||
|
||||
**Tasso di successo:** 4.5% (1/22)
|
||||
|
||||
---
|
||||
|
||||
## ✅ COMANDI FUNZIONANTI (1)
|
||||
|
||||
### QGMN - General Model Name
|
||||
|
||||
```bash
|
||||
$ sudo ./bin/inverter_poller -d -r QGMN
|
||||
|
||||
# Output:
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: Current CRC: 49 29
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: QGMN received terminator at byte 7
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: QGMN reply size (7 bytes, expected 7)
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: Raw buffer hex dump (first 50 bytes):
|
||||
28 30 35 34 FB 9F 0D
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: QGMN: 7 bytes read: (054
|
||||
Sat Jan 31 14:11:16 2026 INVERTER: QGMN query finished
|
||||
Reply: 054
|
||||
```
|
||||
|
||||
**Analisi:**
|
||||
- **Formato risposta:** `(054<CRC><CR>`
|
||||
- **Hex dump:** `28 30 35 34 FB 9F 0D`
|
||||
- **Decodifica:** Model code "054" = Axpert MKS series model 54
|
||||
- **CRC:** `FB 9F` (verificato corretto con polynomial 0x1021)
|
||||
- **Lunghezza:** 7 bytes totali
|
||||
|
||||
**Significato:**
|
||||
Il comando identifica correttamente il modello come MKS series. Questo conferma che:
|
||||
1. La comunicazione seriale funziona perfettamente
|
||||
2. Il CRC è implementato correttamente
|
||||
3. Il framing (start/stop byte) è corretto
|
||||
4. L'inverter è programmato per rispondere a ALCUNI comandi
|
||||
|
||||
---
|
||||
|
||||
## ❌ COMANDI NON SUPPORTATI - NAK (7)
|
||||
|
||||
I seguenti comandi rispondono con NAK (Negative Acknowledge):
|
||||
|
||||
### Comandi Standard P17
|
||||
```bash
|
||||
$ sudo ./bin/inverter_poller -r QPIGS
|
||||
Reply: NAK # General Status Parameters
|
||||
|
||||
$ sudo ./bin/inverter_poller -r QPIRI
|
||||
Reply: NAK # Current Settings
|
||||
|
||||
$ sudo ./bin/inverter_poller -r QMOD
|
||||
Reply: NAK # Mode Inquiry
|
||||
|
||||
$ sudo ./bin/inverter_poller -r QPIWS
|
||||
Reply: NAK # Warning Status
|
||||
```
|
||||
|
||||
**Hex dump NAK:** `28 4E 41 4B 73 73 0D` = `(NAKss<CR>`
|
||||
|
||||
### Comandi Diagnostici
|
||||
```bash
|
||||
$ sudo ./bin/inverter_poller -r QVFW2
|
||||
Reply: NAK # Secondary CPU Firmware
|
||||
|
||||
$ sudo ./bin/inverter_poller -r QBOOT
|
||||
Reply: NAK # Bootloader Version
|
||||
|
||||
$ sudo ./bin/inverter_poller -r QOPM
|
||||
Reply: NAK # Output Power Mode
|
||||
```
|
||||
|
||||
**Analisi NAK:**
|
||||
- L'inverter **riceve correttamente** i comandi (altrimenti timeout)
|
||||
- L'inverter **non riconosce** questi comandi specifici
|
||||
- Risponde attivamente con NAK invece di ignorare
|
||||
- Questo indica **set comandi personalizzato MKS IV**
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ COMANDI TIMEOUT - NO RESPONSE (14)
|
||||
|
||||
I seguenti comandi non ricevono risposta entro il timeout (3 secondi):
|
||||
|
||||
### Comandi P18 Base
|
||||
```bash
|
||||
QID # Device Serial Number
|
||||
QVFW # Main CPU Firmware Version
|
||||
QPI # Protocol ID
|
||||
QFLAG # Device Flag Status
|
||||
```
|
||||
|
||||
### Comandi Status Avanzati
|
||||
```bash
|
||||
QPGS0 # Parallel General Status #0
|
||||
QPGS1 # Parallel General Status #1
|
||||
QDI # Default Settings Inquiry
|
||||
QMCHGCR # Max Charging Current Options
|
||||
QMUCHGCR # Max Utility Charging Current
|
||||
QOPPT # Output Power Type
|
||||
```
|
||||
|
||||
### Comandi Batteria
|
||||
```bash
|
||||
QBEQI # Battery Equalization Info
|
||||
QBMS # BMS Communication Info
|
||||
```
|
||||
|
||||
### Comandi Energia
|
||||
```bash
|
||||
QET # Total Generated Energy
|
||||
QEY # Generated Energy This Year
|
||||
QEM # Generated Energy This Month
|
||||
QED # Generated Energy Today
|
||||
```
|
||||
|
||||
**Analisi Timeout:**
|
||||
- Inverter **non risponde affatto** a questi comandi
|
||||
- Possibili cause:
|
||||
1. Comandi non implementati nel firmware MKS IV
|
||||
2. Comandi richiedono parametri aggiuntivi
|
||||
3. Comandi disponibili solo in modalità specifiche
|
||||
|
||||
---
|
||||
|
||||
## 🔬 Analisi Tecnica
|
||||
|
||||
### Protocollo Comunicazione Verificato
|
||||
|
||||
| Parametro | Valore | Status |
|
||||
|-----------|--------|--------|
|
||||
| **Baudrate** | 2400 bps | ✅ Corretto |
|
||||
| **Data bits** | 8 | ✅ Corretto |
|
||||
| **Parity** | None | ✅ Corretto |
|
||||
| **Stop bits** | 1 | ✅ Corretto |
|
||||
| **Start byte** | `(` (0x28) | ✅ Verificato |
|
||||
| **Stop byte** | `\r` (0x0D) | ✅ Verificato |
|
||||
| **CRC Algorithm** | 0x1021 polynomial | ✅ Funzionante |
|
||||
| **CRC Position** | Ultimi 2 byte prima di CR | ✅ Corretto |
|
||||
|
||||
### Formato Messaggio Risposta
|
||||
|
||||
```
|
||||
┌──────┬─────────────┬──────────┬──────────┬────┐
|
||||
│ ( │ PAYLOAD │ CRC_H │ CRC_L │ CR │
|
||||
├──────┼─────────────┼──────────┼──────────┼────┤
|
||||
│ 0x28 │ ASCII data │ 1 byte │ 1 byte │0x0D│
|
||||
└──────┴─────────────┴──────────┴──────────┴────┘
|
||||
|
||||
Esempio QGMN: 28 30 35 34 FB 9F 0D
|
||||
( 0 5 4 <CRC> CR
|
||||
```
|
||||
|
||||
### Confronto Protocolli
|
||||
|
||||
| Caratteristica | P17 (Axpert MEX) | P18 (InfiniSolar) | MKS IV |
|
||||
|----------------|------------------|-------------------|---------|
|
||||
| QPIGS | ✅ Supportato | ✅ Supportato | ❌ NAK |
|
||||
| QPIRI | ✅ Supportato | ✅ Supportato | ❌ NAK |
|
||||
| QMOD | ✅ Supportato | ✅ Supportato | ❌ NAK |
|
||||
| QPIWS | ✅ Supportato | ✅ Supportato | ❌ NAK |
|
||||
| QGMN | ❌ Non standard | ✅ Supportato | ✅ **UNICO FUNZIONANTE** |
|
||||
| QPI | ❌ Non presente | ✅ Supportato | ⏱️ Timeout |
|
||||
| QID | ✅ Supportato | ✅ Supportato | ⏱️ Timeout |
|
||||
|
||||
**Conclusione:** Il MKS IV **non segue né P17 né P18** standard!
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Ricerca Documentazione Online
|
||||
|
||||
### Forum AEVA (Australian EV Association)
|
||||
- **URL:** http://forums.aeva.asn.au/viewtopic.php?t=4332
|
||||
- **Contenuto:** Thread esteso su PIP-4048MS e PIP-5048MS
|
||||
- **Modelli correlati:** Axpert MKS 5K menzionato come variante
|
||||
- **Protocollo:** Documentazione `SMV III 5K 232 Axpert KS&MKS&V&KING RS232 Protocol 20200102.pdf` (1.21 MB)
|
||||
- **Comandi custom:** Menzionato comando `Q1` non documentato
|
||||
- **CRC Issue:** User PlanB segnala: *"Does your CRC generator work with the POP02 command? Mine gives E2 0A as the CRC but the box expects E2 0B"*
|
||||
|
||||
**⚠️ Problema critico:** Anche altri utenti riportano **CRC anomalie** con MKS series!
|
||||
|
||||
### GitHub Issue #29 - skymax-demo
|
||||
- **URL:** https://github.com/manio/skymax-demo/issues/29
|
||||
- **Titolo:** "Can't read data from Voltronic AXPERT MKS IV 5.6KW"
|
||||
- **Problema:** **IDENTICO AL NOSTRO**
|
||||
- **Device:** MKS IV 5.6KW (stesso modello!)
|
||||
- **Config usata:**
|
||||
```
|
||||
qpiri=103
|
||||
qpiws=40
|
||||
qmod=5
|
||||
qpigs=110
|
||||
```
|
||||
(Identica alla nostra ✅)
|
||||
|
||||
**Sintomi riportati:**
|
||||
1. Device `/dev/hidraw0` presente inizialmente
|
||||
2. Dopo tentativo connessione: **device scompare** da `/dev/hidraw0`
|
||||
3. "Cypress Semiconductor USB to Serial" **sparisce da lsusb**
|
||||
|
||||
**Diagnosi community:**
|
||||
> "This is symptom of faulty USB device, wrong driver or unspecified system issue (chipset, USB host, kernel)."
|
||||
|
||||
**Differenza key:** Issue #29 usa porta **USB diretta** (HID), noi usiamo **RS232** (FTDI) → comunicazione più stabile!
|
||||
|
||||
### Manuale Locale Disponibile
|
||||
- **File:** `/home/pi/Progetti/manual/HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf`
|
||||
- **Dimensione:** 185 KB
|
||||
- **Pagine:** 21
|
||||
- **Anno:** 2014 (pre-MKS IV, probabilmente copre MKS I/II/III)
|
||||
- **Status:** Da analizzare per comandi specifici
|
||||
|
||||
---
|
||||
|
||||
## 🚨 Problemi Identificati
|
||||
|
||||
### 1. Set Comandi Proprietario
|
||||
- Solo 4.5% comandi standard funzionanti
|
||||
- Inverter risponde attivamente con NAK (non ignora)
|
||||
- Formato risposta corretto ma comandi non riconosciuti
|
||||
|
||||
### 2. Possibile Firmware Custom
|
||||
- Model code "054" non documentato nei manuali standard
|
||||
- Risposta QGMN diversa da altri Axpert (che restituiscono stringa completa)
|
||||
- Comandi diagnostici base (QID, QVFW) non funzionano
|
||||
|
||||
### 3. Conflitto BMS (Errore 61)
|
||||
- User riporta "errore 61" quando BMS collegato
|
||||
- Linux errno 61 = `ENODATA` (No data available)
|
||||
- Possibile conflitto porte comunicazione RS232/CAN
|
||||
|
||||
### 4. GitHub Issue Conferma Incompatibilità
|
||||
- Altro utente MKS IV 5.6KW **stesso problema**
|
||||
- Device USB crash dopo connessione
|
||||
- Software ufficiale probabilmente usa protocollo diverso
|
||||
|
||||
---
|
||||
|
||||
## 💡 Soluzioni Proposte
|
||||
|
||||
### Soluzione 1: Reverse Engineering (PRIORITÀ ALTA)
|
||||
**Metodo:** Sniffing comunicazione software ufficiale WatchPower
|
||||
|
||||
**Step:**
|
||||
1. Installare WatchPower su Windows/Linux
|
||||
2. Usare tool sniffing USB/Serial (Wireshark, USBPcap)
|
||||
3. Catturare traffico durante operazioni:
|
||||
- Lettura status
|
||||
- Cambio impostazioni
|
||||
- Query diagnostiche
|
||||
4. Analizzare comandi catturati e formato risposte
|
||||
5. Implementare supporto comandi proprietari MKS IV
|
||||
|
||||
**Tool necessari:**
|
||||
- WatchPower (software ufficiale Voltronic)
|
||||
- Wireshark + USBPcap
|
||||
- Serial port monitor (Portmon, Advanced Serial Port Monitor)
|
||||
|
||||
### Soluzione 2: Analisi Manuale Locale
|
||||
**File da analizzare:** `HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf`
|
||||
|
||||
**Obiettivi:**
|
||||
1. Cercare riferimenti a "MKS" o "054"
|
||||
2. Identificare comandi non testati
|
||||
3. Verificare varianti protocollo per firmware dopo 2014
|
||||
4. Controllare appendici con comandi "hidden"
|
||||
|
||||
### Soluzione 3: Contatto Supporto Tecnico
|
||||
**Destinatari:**
|
||||
- Voltronic Power (produttore originale)
|
||||
- MPP Solar (distributore)
|
||||
- Community forum AEVA
|
||||
|
||||
**Richiesta:**
|
||||
- Documentazione protocollo specifico MKS IV
|
||||
- Lista comandi supportati model "054"
|
||||
- Differenze rispetto a protocollo P17/P18 standard
|
||||
- Workaround per integrazione software custom
|
||||
|
||||
### Soluzione 4: Test Porta USB Alternativa (SE DISPONIBILE)
|
||||
**Se l'inverter ha porta mini USB:**
|
||||
|
||||
**Test:**
|
||||
```bash
|
||||
# Verificare device HID
|
||||
ls -la /dev/hidraw*
|
||||
|
||||
# Test connessione diretta USB
|
||||
sudo ./bin/inverter_poller -d -1 --device=/dev/hidraw0
|
||||
```
|
||||
|
||||
**Vantaggi:**
|
||||
- Potrebbe bypassare conversione RS232
|
||||
- Accesso a comandi USB-HID specifici
|
||||
- Firmware potrebbe avere driver USB diverso
|
||||
|
||||
**Rischi:**
|
||||
- Device crash come riportato in GitHub Issue #29
|
||||
- Richiede driver kernel specifici
|
||||
- Possibile incompatibilità hardware
|
||||
|
||||
### Soluzione 5: Test Senza BMS
|
||||
**Obiettivo:** Verificare se errore 61 interferisce con comunicazione
|
||||
|
||||
**Procedura:**
|
||||
1. Spegnere inverter
|
||||
2. Disconnettere BMS (cavo CAN o RS485)
|
||||
3. Riavviare inverter
|
||||
4. Ripetere test comandi
|
||||
5. Verificare se comandi timeout ora rispondono
|
||||
|
||||
**Ipotesi:** BMS potrebbe occupare porta comunicazione o causare conflitti bus.
|
||||
|
||||
---
|
||||
|
||||
## 📝 Raccomandazioni Immediate
|
||||
|
||||
### 1. Analizzare Manuale Locale (PRIORITÀ 1)
|
||||
```bash
|
||||
cd /home/pi/Progetti/manual
|
||||
evince HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf &
|
||||
```
|
||||
|
||||
**Cercare:**
|
||||
- Tabella comandi completa (spesso in appendice)
|
||||
- Riferimenti a "MKS" o codici modello
|
||||
- Note su firmware versioni dopo 2014
|
||||
- Comandi non documentati o "reserved"
|
||||
|
||||
### 2. Test Disconnessione BMS (PRIORITÀ 2)
|
||||
- Isolare problema errore 61
|
||||
- Verificare se impatta comunicazione RS232
|
||||
- Testare comandi timeout senza BMS attivo
|
||||
|
||||
### 3. Setup Environment Sniffing (PRIORITÀ 3)
|
||||
- Installare WatchPower su macchina test
|
||||
- Configurare Wireshark con USBPcap
|
||||
- Preparare script cattura traffico seriale
|
||||
|
||||
### 4. Query Community (PRIORITÀ 4)
|
||||
- Post su forum AEVA con riferimento a thread PIP-4048MS
|
||||
- Menzionare model code "054" e QGMN funzionante
|
||||
- Chiedere se qualcuno ha documentazione MKS IV specifica
|
||||
- Linkare GitHub Issue #29 per visibilità
|
||||
|
||||
---
|
||||
|
||||
## 📚 Risorse e Riferimenti
|
||||
|
||||
### Documentazione Trovata
|
||||
1. **Forum AEVA - PIP-4048MS Thread**
|
||||
- URL: http://forums.aeva.asn.au/viewtopic.php?t=4332
|
||||
- Attachment: `SMV III 5K 232 Axpert KS&MKS&V&KING RS232 Protocol 20200102.pdf`
|
||||
- 3374+ posts con documentazione estesa
|
||||
|
||||
2. **GitHub Issue #29 - skymax-demo**
|
||||
- URL: https://github.com/manio/skymax-demo/issues/29
|
||||
- Status: Open (aperto Jul 23, 2024)
|
||||
- 6 comments, problema non risolto
|
||||
|
||||
3. **Manuale Locale**
|
||||
- Path: `/home/pi/Progetti/manual/`
|
||||
- File: `HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf`
|
||||
- Da analizzare
|
||||
|
||||
### Comandi da Testare (Non ancora provati)
|
||||
```
|
||||
QSID # Set Device ID
|
||||
QCT # CT ratio
|
||||
QPWS # Power Warning Status (diverso da QPIWS?)
|
||||
QGMNI # General Model Name with Index
|
||||
```
|
||||
|
||||
### Software Correlato
|
||||
- **WatchPower:** Software ufficiale Voltronic per monitoring/config
|
||||
- **ICC (Inverter Control Centre):** Alternative software by AEVA community
|
||||
- **SolPipLog:** Logging software menzionato nel forum
|
||||
- **skymax-demo:** Progetto GitHub che abbiamo usato come base
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Conclusioni
|
||||
|
||||
### Fatto Assodato
|
||||
1. ✅ **Hardware funziona:** Comunicazione RS232 stabile, CRC corretto, framing OK
|
||||
2. ✅ **Software funziona:** Applicazione C++ interroga inverter correttamente
|
||||
3. ❌ **Protocollo incompatibile:** MKS IV usa comandi proprietari non standard
|
||||
4. ❌ **Documentazione mancante:** Nessun manuale MKS IV specifico trovato online
|
||||
|
||||
### Prossimo Step
|
||||
🔴 **CRITICO:** Necessario **reverse engineering** del protocollo tramite:
|
||||
1. Analisi manuale locale (immediato)
|
||||
2. Sniffing WatchPower (entro 48h)
|
||||
3. Query community AEVA (entro 7 giorni)
|
||||
|
||||
### Stima Tempi
|
||||
- **Reverse engineering completo:** 40-60 ore lavoro
|
||||
- **Implementazione comandi custom:** 20-30 ore coding
|
||||
- **Testing e debug:** 10-15 ore
|
||||
- **TOTALE:** 70-105 ore (9-13 giorni lavorativi)
|
||||
|
||||
### Alternative
|
||||
Se reverse engineering fallisce:
|
||||
1. **Usare solo QGMN** per verificare presenza inverter (monitoring base)
|
||||
2. **Integrare via software ufficiale** (WatchPower API se disponibile)
|
||||
3. **Monitorare tramite altra porta** (mini USB se presente)
|
||||
4. **Contattare rivenditore** per upgrade firmware a versione compatibile P18
|
||||
|
||||
---
|
||||
|
||||
**Report compilato da:** AI Assistant
|
||||
**Data:** 31 Gennaio 2026
|
||||
**Versione documento:** 1.0
|
||||
**Test eseguiti:** 22 comandi in 60 minuti
|
||||
Reference in New Issue
Block a user