diff --git a/sources/inverter-mqtt/mqtt-push-parallel.sh b/sources/inverter-mqtt/mqtt-push-parallel.sh index 16a14c9..0dd0ab9 100755 --- a/sources/inverter-mqtt/mqtt-push-parallel.sh +++ b/sources/inverter-mqtt/mqtt-push-parallel.sh @@ -514,9 +514,13 @@ for idx in "${!VALID_SERIALS[@]}"; do [ "${DATA[14]}" ] && pushMQTTData "$inv_id" "PV_in_voltage" "${DATA[14]}" [ "${DATA[25]}" ] && pushMQTTData "$inv_id" "PV_in_current" "${DATA[25]}" - # Calculate PV watts (V * A) - if [ ! -z "${DATA[14]}" ] && [ ! -z "${DATA[25]}" ]; then - PV_WATTS=`echo "${DATA[14]} ${DATA[25]}" | awk '{printf "%.1f", $1 * $2}'` + # Calculate PV watts using battery voltage (DATA[11]) * SCC output current (DATA[25]). + # NOTE: Like QPIGS, DATA[25] ("PV Input Current") is actually the current going to the + # battery FROM the solar charge controller at battery voltage (NOT at PV panel voltage). + # Using PV voltage (DATA[14]) here would give a value ~4-5x too high. + # This mirrors the QPIGS formula: pv_input_watts = scc_voltage * pv_input_current + if [ ! -z "${DATA[11]}" ] && [ ! -z "${DATA[25]}" ]; then + PV_WATTS=`echo "${DATA[11]} ${DATA[25]}" | awk '{printf "%.1f", $1 * $2}'` pushMQTTData "$inv_id" "PV_in_watts" "$PV_WATTS" fi