ned-kelly / docker-voltronic-homeassistant

Programmatically read data from your Voltronic, Axpert, Mppsolar PIP, Voltacon, Effekta etc Inverter and send it to Home Assistant via MQTT - Works with RS232 & USB!
GNU General Public License v3.0
257 stars 140 forks source link

inverter_poller prints not plausible value for Battery_redischarge_voltage #71

Open dilyanpalauzov opened 2 years ago

dilyanpalauzov commented 2 years ago

On my system, inverter_poller prints:

"Battery_redischarge_voltage":121388030977618053106918512643666870272.0,

This value is not realistic. The complete output is:

# inverter_poller -1
{                             
  "Inverter_mode":4,                                                                                                                    
  "AC_grid_voltage":238.3,                                          
  "AC_grid_frequency":50.0,
  "AC_out_voltage":229.6,   
  "AC_out_frequency":49.9,
  "PV_in_voltage":49.0,
  "PV_in_current":7.0,
  "PV_in_watts":345.6,
  "PV_in_watthour":11.5194,
  "SCC_voltage":48.8800,
  "Load_pct":15,
  "Load_watt":736,
  "Load_watthour":24.5333,
  "Load_va":780,
  "Bus_voltage":339,
  "Heatsink_temperature":30,
  "Battery_capacity":46,
  "Battery_voltage":48.80,
  "Battery_charge_current":0,
  "Battery_discharge_current":9,
  "Load_status_on":1,
  "SCC_charge_on":1,
  "AC_charge_on":0,
  "Battery_recharge_voltage":48.0, 
  "Battery_under_voltage":44.0,
  "Battery_bulk_voltage":59.5,
  "Battery_float_voltage":54.7,
  "Max_grid_charge_current":2,
  "Max_charge_current":100,
  "Out_source_priority":1,
  "Charger_source_priority":3,
  "Battery_redischarge_voltage":121388030977618053106918512643666870272.0,
  "Warnings":"00000000000000000000000000000000"
}

My inverter.conf:

device=/dev/hidraw0
run_interval=120
amperage_factor=1.0
watt_factor=1.01
qpiri=102
qpiws=36
qmod=5
qpigs=110
dilyanpalauzov commented 2 years ago

Input from @manio will be highly appreciated.

dilyanpalauzov commented 2 years ago

Debug output

$ inverter_poller -1 -d
Sun Mar 13 14:09:36 2022 INVERTER: Debug set
Sun Mar 13 14:09:36 2022 INVERTER: Current CRC: 49 C1
Sun Mar 13 14:09:36 2022 INVERTER: QMOD reply size (5 bytes)
Sun Mar 13 14:09:36 2022 INVERTER: QMOD: 5 bytes read: (B
Sun Mar 13 14:09:36 2022 INVERTER: QMOD query finished
Sun Mar 13 14:09:36 2022 INVERTER: Current CRC: B7 A9
Sun Mar 13 14:09:37 2022 INVERTER: QPIGS reply size (110 bytes)
Sun Mar 13 14:09:37 2022 INVERTER: QPIGS: 110 bytes read: (238.5 49.9 230.5 50.0 0138 0099 002 360 51.40 004 072 0032 0005 051.5 51.40 0
0000 00110110 00 00 00257 110
Sun Mar 13 14:09:37 2022 INVERTER: QPIGS query finished
Sun Mar 13 14:09:37 2022 INVERTER: Current CRC: F8 54
Sun Mar 13 14:09:37 2022 INVERTER: QPIRI reply size (102 bytes)
Sun Mar 13 14:09:37 2022 INVERTER: QPIRI: 102 bytes read: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 
9 01 0 1 54.0 0 1 000
Sun Mar 13 14:09:37 2022 INVERTER: QPIRI query finished
Sun Mar 13 14:09:37 2022 INVERTER: Current CRC: B4 DA
Sun Mar 13 14:09:38 2022 INVERTER: QPIWS reply size (36 bytes)
Sun Mar 13 14:09:38 2022 INVERTER: QPIWS: 36 bytes read: (00000000000000000000000000000000
Sun Mar 13 14:09:38 2022 INVERTER: QPIWS query finished
INVERTER: ampfactor from config is 1.00
INVERTER: wattfactor from config is 1.01
{                             
  "Inverter_mode":4,                                                                                                                    
  "AC_grid_voltage":238.5,                                          
  "AC_grid_frequency":49.9,
  "AC_out_voltage":230.5,                                                                                                               
   "AC_out_frequency":50.0,  
  "PV_in_voltage":51.5,
  "PV_in_current":5.0,
  "PV_in_watts":259.6,
  "PV_in_watthour":8.6523,
  "SCC_voltage":51.4000,
  "Load_pct":2,
  "Load_watt":99,
  "Load_watthour":3.3000,
  "Load_va":138,
  "Bus_voltage":360,
  "Heatsink_temperature":32,
  "Battery_capacity":72,
  "Battery_voltage":51.40,
  "Battery_charge_current":4,
  "Battery_discharge_current":0,
  "Load_status_on":1,
  "SCC_charge_on":1,
  "AC_charge_on":0,
  "Battery_recharge_voltage":48.0, 
  "Battery_under_voltage":44.0,
  "Battery_bulk_voltage":59.5,
  "Battery_float_voltage":54.7,
  "Max_grid_charge_current":2,
  "Max_charge_current":100,
  "Out_source_priority":1,
  "Charger_source_priority":3,
  "Battery_redischarge_voltage":104980372904647997800762144243331366912.0,
  "Warnings":"00000000000000000000000000000000"
}
Sun Mar 13 14:09:38 2022 INVERTER: All queries complete, exiting loop.
dilyanpalauzov commented 2 years ago

Mapping the result of the QPIRI command, as taken from the manual at https://github.com/ned-kelly/docker-voltronic-homeassistant/blob/master/manual/HS_MS_MSX_RS232_Protocol_20140822_after_current_upgrade.pdf to the actual data returned

(230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 9 01 0 1 54.0 0 1 000
(BBB.B CC.C DDD.D EE.E FF.F HHHH IIII JJ.J KK.K JJ.J KK.K LL.L O PP QQ0 O P Q R SS T U VV.V W X

So VV.V (Battery re-discharge voltage) is 54.0, but it is displayed incorrecty as 104980372904647997800762144243331366912.0.

Where can I find an updated protocol reference, defining the meaning of the final value after X, thus what means here the terminating 000?

dilyanpalauzov commented 2 years ago

I got it. The protocol says for QPIRI’s R (Parallel max num) — R is an Integer ranging from 0 to 9), while scanf() in inverter-cli/main.cpp expected for this position the dash character -.

The modification at https://github.com/ned-kelly/docker-voltronic-homeassistant/pull/72 accepts in place of - any character, which in my case is 9.