-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from bootix/script-interface
## V1.85 ### script * Added shell script based powermeter interface (USE_SCRIPT) ### config * Added parameters for shell script based powermeter interface (SCRIPT_) ### bash script * Added example shell script for usage with Victron Multiplus II (GetPowerFromVictronMultiplus.sh) ### * Updated supported interface list in README.md with new shell script based powermeter
- Loading branch information
Showing
5 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /bin/sh | ||
|
||
# Script to read powermeter values from a Victron Multiplus II | ||
# Needs "mbpoll" (command line utility to communicate with ModBus slave) to be installed, e.g. "apt install mbpoll" | ||
# Usage: GetPowerFromVictronMultiplus <ip-address> [<username>] [<password>] | ||
|
||
|
||
# read registers 820-822 via ModbusTCP | ||
VE_SYSTEM=`mbpoll "$1" -a 100 -r 820 -c 3 -t 3 -0 -1 | grep "\[.*\]:"` | ||
if [ $? -ne 0 ]; then | ||
# failed, one more try | ||
sleep 1 | ||
VE_SYSTEM=`mbpoll "$1" -a 100 -r 820 -c 3 -t 3 -0 -1 | grep "\[.*\]:"` | ||
if [ $? -ne 0 ]; then | ||
type mbpoll > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "$0: mbpoll must be installed!" | ||
else | ||
echo 0 | ||
fi | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# /Ac/Grid/L1/Power | ||
AC_GRID_L1=`echo "$VE_SYSTEM" | sed -n -e "s/\[820\]:.*(\(.*\)).*/\1/p" -e "s/\[820\]:[^0-9][^0-9]*\(.*\)/\1/p"` | ||
|
||
# /Ac/Grid/L2/Power | ||
AC_GRID_L2=`echo "$VE_SYSTEM" | sed -n -e "s/\[821\]:.*(\(.*\)).*/\1/p" -e "s/\[821\]:[^0-9][^0-9]*\(.*\)/\1/p"` | ||
|
||
# /Ac/Grid/L3/Power | ||
AC_GRID_L3=`echo "$VE_SYSTEM" | sed -n -e "s/\[822\]:.*(\(.*\)).*/\1/p" -e "s/\[822\]:[^0-9][^0-9]*\(.*\)/\1/p"` | ||
|
||
expr "$AC_GRID_L1" + "$AC_GRID_L2" + "$AC_GRID_L3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters