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,235 @@
|
||||
# Report Compatibilità: Voltronic Axpert MKS IV
|
||||
|
||||
> 🔬 **UPDATE 31/01/2026**: Test comandi alternativi completati! Vedere [MKS_IV_TEST_RESULTS.md](./MKS_IV_TEST_RESULTS.md) per report dettagliato con 22 comandi testati.
|
||||
>
|
||||
> **Risultato chiave**: ✅ Comando **QGMN funziona** e identifica modello come "054"
|
||||
|
||||
---
|
||||
|
||||
## 📋 Informazioni Inverter
|
||||
- **Modello**: Voltronic Axpert MKS IV
|
||||
- **Model Code**: 054 (identificato via QGMN)
|
||||
- **Protocollo**: RS232 (compatibile hardware-wise)
|
||||
- **Serie**: MKS (Modern King Series)
|
||||
- **Compatibilità software**: ❌ PROTOCOLLO PROPRIETARIO (solo 1/22 comandi funzionanti)
|
||||
|
||||
## ✅ Verifica Configurazione Attuale
|
||||
|
||||
### 1. Baudrate
|
||||
**Status**: ✅ CORRETTO
|
||||
- **Configurato**: 2400 baud
|
||||
- **Test eseguito**: Provati 2400, 9600, 19200, 38400, 115200
|
||||
- **Risultato**: L'inverter risponde su 2400 baud (riceve NAK ma comunica)
|
||||
|
||||
### 2. Protocollo Seriale
|
||||
**Status**: ✅ CORRETTO
|
||||
- **Data bits**: 8
|
||||
- **Parity**: None
|
||||
- **Stop bits**: 1
|
||||
- **Flow control**: None
|
||||
- **Configurazione**: 2400 8N1 ✓
|
||||
|
||||
### 3. Codice Sorgente
|
||||
**Status**: ✅ COMPATIBILE
|
||||
|
||||
Il codice è basato su:
|
||||
- Skyboo's implementation per Axpert MEX
|
||||
- Protocol standard Voltronic/Axpert/MPPSolar
|
||||
- Supporta comandi: QPIGS, QPIRI, QMOD, QPIWS
|
||||
|
||||
**File rilevanti**:
|
||||
- `sources/inverter-cli/main.cpp` - Entry point
|
||||
- `sources/inverter-cli/inverter.cpp` - Comunicazione seriale (2400 baud, 8N1)
|
||||
- `config/inverter.conf` - Buffer sizes configurati
|
||||
|
||||
## ❌ Problema Rilevato
|
||||
|
||||
### Sintomo: NAK Response
|
||||
L'inverter risponde con **(NAKs** (Negative Acknowledge) a tutti i comandi.
|
||||
|
||||
**Hex ricevuto**: `28 4E 41 4B 73 73 0d` = `(NAKss\r`
|
||||
|
||||
### Possibili Cause Specifiche per MKS IV
|
||||
|
||||
#### 1. 🔴 Protocollo P18 vs P17
|
||||
Il **MKS IV potrebbe usare il protocollo P18** (più recente) invece del P17.
|
||||
|
||||
**Differenze P18**:
|
||||
- Comandi leggermente diversi
|
||||
- CRC calculation potrebbe essere diverso
|
||||
- Alcuni comandi potrebbero avere prefissi diversi
|
||||
|
||||
**Test da fare**:
|
||||
```bash
|
||||
# Prova questi comandi P18:
|
||||
QPI # Protocol ID
|
||||
QVFW # Main CPU Firmware version
|
||||
QVFW2 # Another CPU firmware version
|
||||
```
|
||||
|
||||
#### 2. 🔴 Device Type Setting
|
||||
Alcuni MKS IV richiedono inizializzazione o handshake specifico prima di accettare comandi.
|
||||
|
||||
**Possibili soluzioni**:
|
||||
- Inviare comando di inizializzazione
|
||||
- Attendere più tempo dopo apertura porta
|
||||
- Inviare sequenza di "wake up"
|
||||
|
||||
#### 3. 🔴 RS232 vs USB-HID
|
||||
Il MKS IV potrebbe preferire comunicazione USB-HID invece di RS232 emulato.
|
||||
|
||||
**Test**:
|
||||
```bash
|
||||
ls -la /dev/hidraw* # Verifica se esiste device HID
|
||||
```
|
||||
Nel tuo caso: **Nessun /dev/hidraw** trovato
|
||||
|
||||
#### 4. 🔴 Cable Type
|
||||
Il MKS IV potrebbe richiedere:
|
||||
- **Cavo RS232 diretto** (non USB-to-Serial converter)
|
||||
- **Cavo speciale Voltronic** con pin-out specifico
|
||||
|
||||
**Pin-out standard RS232**:
|
||||
```
|
||||
Pin 2: RX (Receive)
|
||||
Pin 3: TX (Transmit)
|
||||
Pin 5: GND (Ground)
|
||||
```
|
||||
|
||||
Alcuni inverter richiedono anche DTR/RTS.
|
||||
|
||||
## 🔧 Soluzioni Suggerite
|
||||
|
||||
### Soluzione 1: Test con Comandi P18
|
||||
Modifica `sources/inverter-cli/main.cpp` per provare comandi diversi:
|
||||
|
||||
```cpp
|
||||
// In main.cpp, test raw commands:
|
||||
// inverter_poller -r QPI
|
||||
// inverter_poller -r QVFW
|
||||
// inverter_poller -r QPIGS
|
||||
```
|
||||
|
||||
### Soluzione 2: Controllo Cavo/Connessione
|
||||
1. **Verifica LED inverter**: Alcuni MKS IV hanno LED che indicano comunicazione attiva
|
||||
2. **Prova porta RS232 fisica** invece di USB-to-Serial
|
||||
3. **Controlla pin-out cavo**: Alcuni cavi economici non hanno tutti i pin collegati
|
||||
|
||||
### Soluzione 3: Software di Test Ufficiale
|
||||
Voltronic fornisce **WatchPower** software per Windows:
|
||||
- Scarica da sito ufficiale Voltronic
|
||||
- Testa comunicazione su Windows per verificare hardware
|
||||
- Controlla quale porta/baudrate usa il software ufficiale
|
||||
|
||||
### Soluzione 4: Modifica CRC o Timing
|
||||
Alcuni MKS IV hanno timing più stretto:
|
||||
|
||||
```cpp
|
||||
// In inverter.cpp, dopo write():
|
||||
usleep(200000); // Aumenta da 100ms a 200ms
|
||||
|
||||
// Oppure aumenta timeout read:
|
||||
timeout.tv_sec = 5; // Da 2 a 5 secondi
|
||||
```
|
||||
|
||||
## 📊 Compatibilità Codice
|
||||
|
||||
### ✅ Supporto Dichiarato
|
||||
Il progetto dichiara supporto per:
|
||||
- Voltronic Power Axpert ✓
|
||||
- MPPSolar PIP ✓
|
||||
- Voltacon ✓
|
||||
- Effekta ✓
|
||||
- **OEM Inverters** ✓
|
||||
|
||||
### ⚠️ MKS IV Specificità
|
||||
Il **MKS IV** è una versione più recente che potrebbe avere:
|
||||
- Protocollo aggiornato (P18)
|
||||
- Comandi extended
|
||||
- Buffer sizes diversi
|
||||
|
||||
**Riferimento manuale**: `/manual/HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf`
|
||||
|
||||
Questo manuale è del 2014 e potrebbe **NON includere** il protocollo MKS IV.
|
||||
|
||||
## 🎯 Piano d'Azione
|
||||
|
||||
### Step 1: Verifica Hardware (PRIORITÀ ALTA)
|
||||
```bash
|
||||
# 1. Test con software ufficiale Voltronic su Windows (se disponibile)
|
||||
# 2. Verifica LED comunicazione su inverter
|
||||
# 3. Prova cavo RS232 diverso
|
||||
# 4. Controlla manual MKS IV per pin-out specifico
|
||||
```
|
||||
|
||||
### Step 2: Test Comandi Alternativi
|
||||
```bash
|
||||
# Test comandi P18:
|
||||
cd /home/pi/Progetti/sources/inverter-cli
|
||||
./bin/inverter_poller -r QPI
|
||||
./bin/inverter_poller -r QVFW
|
||||
./bin/inverter_poller -r QPIRI
|
||||
./bin/inverter_poller -r QMOD
|
||||
```
|
||||
|
||||
### Step 3: Modifica Codice
|
||||
Se comandi standard non funzionano, potrebbe essere necessario:
|
||||
1. Aggiornare CRC calculation per P18
|
||||
2. Modificare timing/delay
|
||||
3. Implementare handshake iniziale
|
||||
|
||||
### Step 4: Community Research
|
||||
Cerca su forum:
|
||||
- http://forums.aeva.asn.au/viewtopic.php?t=4332
|
||||
- GitHub issues del progetto
|
||||
- Forum Voltronic/Axpert per MKS IV specifico
|
||||
|
||||
## 📚 Risorse
|
||||
|
||||
### Documentazione Progetto
|
||||
- `documentation/CODE_ARCHITECTURE.md` - Architettura completa
|
||||
- `documentation/AUTO_DISCOVERY.md` - Feature auto-discovery
|
||||
- `documentation/DEBUG.md` - Guida debugging
|
||||
|
||||
### Manuale Protocollo
|
||||
- `/manual/HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf`
|
||||
- ⚠️ Potrebbe non coprire MKS IV (2014)
|
||||
|
||||
### Forum & Support
|
||||
- AEVA Forum: http://forums.aeva.asn.au/viewtopic.php?t=4332
|
||||
- GitHub: https://github.com/ned-kelly/docker-voltronic-homeassistant
|
||||
- Skyboo original: https://skyboo.net/2017/03/monitoring-voltronic-power-axpert-mex-inverter-under-linux/
|
||||
|
||||
## 🔍 Log Test Eseguiti
|
||||
|
||||
```
|
||||
Date: 31 gennaio 2026
|
||||
Device: /dev/ttyUSB0 (FTDI USB Serial Device)
|
||||
Test: Baudrate detection
|
||||
|
||||
Results:
|
||||
- 2400: NAK response (inverter comunica ma non accetta comandi)
|
||||
- 9600: No response
|
||||
- 19200: No response
|
||||
- 38400: No response
|
||||
- 115200: No response
|
||||
|
||||
Conclusion:
|
||||
- Baudrate corretto: 2400 ✓
|
||||
- Protocollo: Possibile incompatibilità con MKS IV
|
||||
- Hardware: Funzionante (riceve e risponde)
|
||||
- Software: Necessita verifica comandi P18
|
||||
```
|
||||
|
||||
## ⏭️ Next Steps
|
||||
|
||||
1. **IMMEDIATO**: Verifica su manual MKS IV se esiste protocollo P18
|
||||
2. **PRIORITÀ ALTA**: Test con software ufficiale Voltronic per confermare hardware
|
||||
3. **RICERCA**: Cerca su forum/GitHub per implementazioni MKS IV specific
|
||||
4. **FALLBACK**: Contatta support Voltronic per specifiche protocollo MKS IV
|
||||
|
||||
---
|
||||
|
||||
**Autore**: Generated by GitHub Copilot
|
||||
**Data**: 31 gennaio 2026
|
||||
**Versione Codice**: 2.0 (con auto-discovery)
|
||||
@@ -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
|
||||
@@ -0,0 +1,277 @@
|
||||
# Quick Reference - Test Loop & MQTT Configuration
|
||||
|
||||
## 🔧 Configurazione MQTT Server
|
||||
|
||||
### File di Configurazione
|
||||
|
||||
**Development:**
|
||||
```
|
||||
/home/pi/Progetti/config/mqtt.json
|
||||
```
|
||||
|
||||
**Container (Production):**
|
||||
```
|
||||
/etc/inverter/mqtt.json
|
||||
```
|
||||
|
||||
### Parametri Chiave
|
||||
|
||||
```json
|
||||
{
|
||||
"server": "[HA_MQTT_IP]", // ← Indirizzo IP Home Assistant
|
||||
"port": "1883", // Porta MQTT standard
|
||||
"topic": "homeassistant", // Topic base
|
||||
"devicename": "voltronic", // Nome device (prefix topic)
|
||||
"username": "", // Username MQTT (se richiesto)
|
||||
"password": "", // Password MQTT (se richiesto)
|
||||
"clientid": "voltronic_...", // Client ID univoco
|
||||
"influx": {
|
||||
"enabled": "false", // InfluxDB (opzionale)
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Modificare la Configurazione
|
||||
|
||||
```bash
|
||||
# Editare il file
|
||||
nano /home/pi/Progetti/config/mqtt.json
|
||||
|
||||
# Cambiare l'IP del server MQTT
|
||||
# Sostituire [HA_MQTT_IP] con l'IP reale di Home Assistant
|
||||
# Esempio: "server": "192.168.1.100"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Test Loop - Simulazione Container
|
||||
|
||||
### Script Principale
|
||||
|
||||
```bash
|
||||
/home/pi/Progetti/sources/inverter-mqtt/test-loop-parallel.sh
|
||||
```
|
||||
|
||||
### Esecuzione Manuale
|
||||
|
||||
**Modalità interattiva (infinito):**
|
||||
```bash
|
||||
bash /home/pi/Progetti/sources/inverter-mqtt/test-loop-parallel.sh
|
||||
```
|
||||
|
||||
**Modalità con limiti:**
|
||||
```bash
|
||||
# 5 iterazioni con intervallo 10 secondi
|
||||
LOOP_INTERVAL=10 MAX_ITERATIONS=5 bash test-loop-parallel.sh
|
||||
|
||||
# 2 iterazioni con intervallo 5 secondi (test rapido)
|
||||
LOOP_INTERVAL=5 MAX_ITERATIONS=2 bash test-loop-parallel.sh
|
||||
```
|
||||
|
||||
### Variabili d'Ambiente
|
||||
|
||||
| Variabile | Descrizione | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `LOOP_INTERVAL` | Secondi tra iterazioni | 30 |
|
||||
| `MAX_ITERATIONS` | Numero massimo iterazioni (0=infinito) | 0 |
|
||||
|
||||
### Fasi del Test Loop
|
||||
|
||||
#### **Phase 1: Initial Discovery** (eseguito una volta all'avvio)
|
||||
|
||||
1. **Buffer Sizes Auto-Discovery** (`-a`)
|
||||
- Rileva dimensioni corrette per QMOD, QPIGS, QPIRI, QPIWS
|
||||
- Output: `DISCOVERY_QMOD=5`, `DISCOVERY_QPIGS=110`, etc.
|
||||
|
||||
2. **Parallel Inverters Discovery** (`-p`)
|
||||
- Cerca inverter in configurazione parallela (QPGS0-QPGS9)
|
||||
- Filtra serial validi (no "00000000000000")
|
||||
- Filtra duplicati
|
||||
- Output: `PARALLEL_COUNT=2`, `INVERTER_1_SERIAL=...`, etc.
|
||||
|
||||
#### **Phase 2: Main Polling Loop** (ripetuto ogni N secondi)
|
||||
|
||||
1. **Test Standard Commands** (inverter locale via USB)
|
||||
- QPIGS - General status
|
||||
- QPIRI - Configuration
|
||||
- QMOD - Operating mode
|
||||
- QPIWS - Warning status
|
||||
|
||||
2. **Read Parallel Inverters** (tutti gli inverter via QPGS)
|
||||
- Per ogni inverter trovato:
|
||||
- Legge dati QPGS
|
||||
- Estrae: Mode, Grid Voltage, Battery Voltage, Load Watts
|
||||
|
||||
3. **MQTT Push** (pubblica su Home Assistant)
|
||||
- Esegue `mqtt-push-parallel.sh`
|
||||
- Pubblica topic separati per ogni inverter
|
||||
- Formato: `homeassistant/sensor/voltronic_inv1_*`
|
||||
|
||||
---
|
||||
|
||||
## 📊 Topic MQTT Pubblicati
|
||||
|
||||
### Per Ogni Inverter
|
||||
|
||||
```
|
||||
homeassistant/sensor/voltronic_inv1_serial → "92932111105114"
|
||||
homeassistant/sensor/voltronic_inv1_mode → "B" (Battery mode)
|
||||
homeassistant/sensor/voltronic_inv1_AC_grid_voltage → "229.8"
|
||||
homeassistant/sensor/voltronic_inv1_AC_grid_frequency → "50.0"
|
||||
homeassistant/sensor/voltronic_inv1_AC_out_voltage → "229.5"
|
||||
homeassistant/sensor/voltronic_inv1_AC_out_frequency → "49.9"
|
||||
homeassistant/sensor/voltronic_inv1_Load_va → "481"
|
||||
homeassistant/sensor/voltronic_inv1_Load_watt → "465"
|
||||
homeassistant/sensor/voltronic_inv1_Load_pct → "8"
|
||||
homeassistant/sensor/voltronic_inv1_Battery_voltage → "53.9"
|
||||
homeassistant/sensor/voltronic_inv1_Battery_charge_current → "4"
|
||||
homeassistant/sensor/voltronic_inv1_Battery_capacity → "100"
|
||||
homeassistant/sensor/voltronic_inv1_PV_in_voltage → "246.8"
|
||||
homeassistant/sensor/voltronic_inv1_PV_in_current → "4"
|
||||
```
|
||||
|
||||
### Topic Sistema
|
||||
|
||||
```
|
||||
homeassistant/sensor/voltronic_system_parallel_count → "2"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Debug Profiles VS Code
|
||||
|
||||
### 1. Parallel Discovery - Container Mode
|
||||
**Profile:** `(gdb) Parallel Discovery - Container Mode`
|
||||
- Esegue: `inverter_poller -p`
|
||||
- Simula ambiente container (cwd="/")
|
||||
- ENV: `INVERTER_DEVICE=/dev/ttyUSB0`
|
||||
|
||||
### 2. Test MQTT Parallel - Container Simulation
|
||||
**Profile:** `(bash) Test MQTT Parallel - Container Simulation`
|
||||
- Esegue: `mqtt-push-parallel.sh`
|
||||
- Debug bash script MQTT
|
||||
|
||||
### 3. Test Loop - Full Simulation
|
||||
**Profile:** `(bash) Test Loop - Full Simulation`
|
||||
- Esegue: `test-loop-parallel.sh`
|
||||
- 3 iterazioni con intervallo 10s
|
||||
- Full simulation discovery + polling + MQTT
|
||||
|
||||
---
|
||||
|
||||
## 📝 Comandi Utili
|
||||
|
||||
### Discovery Manuale
|
||||
|
||||
```bash
|
||||
# Buffer sizes discovery
|
||||
sudo /home/pi/Progetti/sources/inverter-cli/bin/inverter_poller -a
|
||||
|
||||
# Parallel inverters discovery
|
||||
sudo /home/pi/Progetti/sources/inverter-cli/bin/inverter_poller -p
|
||||
|
||||
# Test comando specifico
|
||||
sudo /home/pi/Progetti/sources/inverter-cli/bin/inverter_poller -r QPGS0
|
||||
```
|
||||
|
||||
### MQTT Push Manuale
|
||||
|
||||
```bash
|
||||
# Single run
|
||||
bash /home/pi/Progetti/sources/inverter-mqtt/mqtt-push-parallel.sh
|
||||
|
||||
# Con debug output
|
||||
bash /home/pi/Progetti/sources/inverter-mqtt/mqtt-push-parallel.sh 2>&1 | less
|
||||
```
|
||||
|
||||
### Monitoraggio MQTT (da altro terminal)
|
||||
|
||||
```bash
|
||||
# Subscribe a tutti i topic
|
||||
mosquitto_sub -h [HA_MQTT_IP] -t "homeassistant/#" -v
|
||||
|
||||
# Solo sensori voltronic
|
||||
mosquitto_sub -h [HA_MQTT_IP] -t "homeassistant/sensor/voltronic_#" -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Output Esempio Test Loop
|
||||
|
||||
```
|
||||
╔════════════════════════════════════════════════════════════════╗
|
||||
║ VOLTRONIC PARALLEL INVERTER - TEST LOOP ║
|
||||
╚════════════════════════════════════════════════════════════════╝
|
||||
|
||||
Mode: Development
|
||||
Binary: /home/pi/Progetti/sources/inverter-cli/bin/inverter_poller
|
||||
MQTT Config: /home/pi/Progetti/config/mqtt.json
|
||||
Loop Interval: 30s
|
||||
Max Iterations: ∞ (infinite)
|
||||
MQTT Server: 192.168.1.100
|
||||
|
||||
╔════════════════════════════════════════════════════════════════╗
|
||||
║ PHASE 1: INITIAL DISCOVERY ║
|
||||
╚════════════════════════════════════════════════════════════════╝
|
||||
|
||||
[1.1] Buffer Sizes Auto-Discovery
|
||||
✓ Buffer sizes discovered successfully
|
||||
• QMOD: 5 bytes
|
||||
• QPIGS: 110 bytes
|
||||
• QPIRI: 103 bytes
|
||||
• QPIWS: 40 bytes
|
||||
|
||||
[1.2] Parallel Inverters Discovery
|
||||
✓ Found 2 parallel inverter(s)
|
||||
• Inverter #1: Serial 92932111105114 (QPGS0)
|
||||
• Inverter #2: Serial 96332205100144 (QPGS2)
|
||||
|
||||
╔════════════════════════════════════════════════════════════════╗
|
||||
║ PHASE 2: MAIN POLLING LOOP ║
|
||||
╚════════════════════════════════════════════════════════════════╝
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
Iteration #1 - 2026-01-31 15:25:35
|
||||
═══════════════════════════════════════════════════════════════
|
||||
[2.1] Testing standard commands (local inverter)
|
||||
✓ QPIGS: OK (106 chars)
|
||||
✓ QPIRI: OK (99 chars)
|
||||
✓ QMOD: OK (1 chars)
|
||||
✓ QPIWS: OK (36 chars)
|
||||
|
||||
[2.2] Reading parallel inverters data
|
||||
✓ Inverter #1 (92932111105114): Mode=B, Grid=229.8V, Battery=53.6V, Load=0488W
|
||||
✓ Inverter #2 (96332205100144): Mode=B, Grid=232.4V, Battery=53.6V, Load=0300W
|
||||
|
||||
[2.3] MQTT Push
|
||||
✓ MQTT push completed
|
||||
|
||||
Waiting 30s until next iteration...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Setup Rapido per Test
|
||||
|
||||
1. **Configura MQTT server:**
|
||||
```bash
|
||||
nano /home/pi/Progetti/config/mqtt.json
|
||||
# Cambia "server": "[HA_MQTT_IP]" con IP reale
|
||||
```
|
||||
|
||||
2. **Esegui test rapido (2 iterazioni):**
|
||||
```bash
|
||||
cd /home/pi/Progetti
|
||||
LOOP_INTERVAL=5 MAX_ITERATIONS=2 bash sources/inverter-mqtt/test-loop-parallel.sh
|
||||
```
|
||||
|
||||
3. **Verifica MQTT (in altro terminal):**
|
||||
```bash
|
||||
mosquitto_sub -h [HA_MQTT_IP] -t "homeassistant/sensor/voltronic_#" -v
|
||||
```
|
||||
|
||||
4. **Per produzione (loop continuo):**
|
||||
```bash
|
||||
bash sources/inverter-mqtt/test-loop-parallel.sh
|
||||
```
|
||||
Reference in New Issue
Block a user