Skip to content

Commit

Permalink
utilize automatic script detection for second inverter in json module
Browse files Browse the repository at this point in the history
  • Loading branch information
yankee42 committed Feb 27, 2023
1 parent a4e37aa commit a334643
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
27 changes: 0 additions & 27 deletions modules/wr2_json/main.sh

This file was deleted.

14 changes: 10 additions & 4 deletions modules/wr_json/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ else
MYLOGFILE="${RAMDISKDIR}/nurpv.log"
fi

openwbDebugLog ${DMOD} 2 "PV URL : ${wrjsonurl}"
openwbDebugLog ${DMOD} 2 "PV Watt: ${wrjsonwatt}"
openwbDebugLog ${DMOD} 2 "PV kWh : ${wrjsonkwh}"
inverter_num=${1:-1}
[[ "$inverter_num" -gt 1 ]] && config_prefix="wr$1" || config_prefix="wr"
declare -n "config_url=${config_prefix}jsonurl"
declare -n "config_watt=${config_prefix}jsonwatt"
declare -n "config_kwh=${config_prefix}jsonkwh"

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.devices.json.device" "inverter" "${wrjsonurl}" "${wrjsonwatt}" "${wrjsonkwh}" "1" >>"$MYLOGFILE" 2>&1
openwbDebugLog ${DMOD} 2 "PV URL : ${config_url}"
openwbDebugLog ${DMOD} 2 "PV Watt: ${config_watt}"
openwbDebugLog ${DMOD} 2 "PV kWh : ${config_kwh}"

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.devices.json.device" "inverter" "$config_url" "$config_watt" "$config_kwh" "$inverter_num" >>"$MYLOGFILE" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "RET: ${ret}"
Expand Down

0 comments on commit a334643

Please sign in to comment.