Organizes 11 projects for Cerbo GX/Venus OS into a single repository: - axiom-nmea: Raymarine LightHouse protocol decoder - dbus-generator-ramp: Generator current ramp controller - dbus-lightning: Blitzortung lightning monitor - dbus-meteoblue-forecast: Meteoblue weather forecast - dbus-no-foreign-land: noforeignland.com tracking - dbus-tides: Tide prediction from depth + harmonics - dbus-vrm-history: VRM cloud history proxy - dbus-windy-station: Windy.com weather upload - mfd-custom-app: MFD app deployment package - venus-html5-app: Custom Victron HTML5 app fork - watermaker: Watermaker PLC control UI Adds root README, .gitignore, project template, and per-project .gitignore files. Sensitive config files excluded via .gitignore with .example templates provided. Made-with: Cursor
114 lines
3.4 KiB
Bash
114 lines
3.4 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
INSTALL_DIR="/data/dbus-vrm-history"
|
|
VELIB_DIR=""
|
|
if [ -d "/opt/victronenergy/velib_python" ]; then
|
|
VELIB_DIR="/opt/victronenergy/velib_python"
|
|
else
|
|
for candidate in \
|
|
"/opt/victronenergy/dbus-systemcalc-py/ext/velib_python" \
|
|
"/opt/victronenergy/dbus-generator/ext/velib_python" \
|
|
"/opt/victronenergy/dbus-mqtt/ext/velib_python" \
|
|
"/opt/victronenergy/dbus-digitalinputs/ext/velib_python" \
|
|
"/opt/victronenergy/vrmlogger/ext/velib_python"
|
|
do
|
|
if [ -d "$candidate" ] && [ -f "$candidate/vedbus.py" ]; then
|
|
VELIB_DIR="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ -z "$VELIB_DIR" ]; then
|
|
VEDBUS_PATH=$(find /opt/victronenergy -name "vedbus.py" -path "*/velib_python/*" 2>/dev/null | head -1)
|
|
if [ -n "$VEDBUS_PATH" ]; then
|
|
VELIB_DIR=$(dirname "$VEDBUS_PATH")
|
|
fi
|
|
fi
|
|
|
|
if [ -d "/service" ] && [ ! -L "/service" ]; then
|
|
SERVICE_DIR="/service"
|
|
elif [ -d "/opt/victronenergy/service" ]; then
|
|
SERVICE_DIR="/opt/victronenergy/service"
|
|
elif [ -L "/service" ]; then
|
|
SERVICE_DIR=$(readlink -f /service)
|
|
else
|
|
SERVICE_DIR="/opt/victronenergy/service"
|
|
fi
|
|
|
|
echo "=================================================="
|
|
echo "VRM History Service - Installation"
|
|
echo "=================================================="
|
|
|
|
if [ ! -d "$SERVICE_DIR" ]; then
|
|
echo "ERROR: Not a Venus OS device."; exit 1
|
|
fi
|
|
|
|
echo "Service directory: $SERVICE_DIR"
|
|
|
|
if [ ! -f "$INSTALL_DIR/dbus-vrm-history.py" ]; then
|
|
echo "ERROR: Files not found in $INSTALL_DIR"; exit 1
|
|
fi
|
|
|
|
echo "1. Making scripts executable..."
|
|
chmod +x "$INSTALL_DIR/service/run"
|
|
chmod +x "$INSTALL_DIR/service/log/run"
|
|
chmod +x "$INSTALL_DIR/dbus-vrm-history.py"
|
|
|
|
echo "2. Creating velib_python symlink..."
|
|
if [ -z "$VELIB_DIR" ]; then
|
|
echo "ERROR: Could not find velib_python"; exit 1
|
|
fi
|
|
echo " Found: $VELIB_DIR"
|
|
mkdir -p "$INSTALL_DIR/ext"
|
|
if [ -L "$INSTALL_DIR/ext/velib_python" ]; then
|
|
CURRENT_TARGET=$(readlink "$INSTALL_DIR/ext/velib_python")
|
|
if [ "$CURRENT_TARGET" != "$VELIB_DIR" ]; then
|
|
rm "$INSTALL_DIR/ext/velib_python"
|
|
fi
|
|
fi
|
|
if [ ! -L "$INSTALL_DIR/ext/velib_python" ]; then
|
|
ln -s "$VELIB_DIR" "$INSTALL_DIR/ext/velib_python"
|
|
fi
|
|
|
|
echo "3. Creating service symlink..."
|
|
if [ -L "$SERVICE_DIR/dbus-vrm-history" ]; then
|
|
rm "$SERVICE_DIR/dbus-vrm-history"
|
|
fi
|
|
if [ -e "$SERVICE_DIR/dbus-vrm-history" ]; then
|
|
rm -rf "$SERVICE_DIR/dbus-vrm-history"
|
|
fi
|
|
ln -s "$INSTALL_DIR/service" "$SERVICE_DIR/dbus-vrm-history"
|
|
|
|
echo "4. Creating log directory..."
|
|
mkdir -p /var/log/dbus-vrm-history
|
|
|
|
echo "5. Setting up rc.local..."
|
|
RC_LOCAL="/data/rc.local"
|
|
if [ ! -f "$RC_LOCAL" ]; then
|
|
echo "#!/bin/bash" > "$RC_LOCAL"
|
|
chmod +x "$RC_LOCAL"
|
|
fi
|
|
if ! grep -q "dbus-vrm-history" "$RC_LOCAL"; then
|
|
echo "" >> "$RC_LOCAL"
|
|
echo "# VRM History Service" >> "$RC_LOCAL"
|
|
echo "if [ ! -L $SERVICE_DIR/dbus-vrm-history ]; then" >> "$RC_LOCAL"
|
|
echo " ln -s /data/dbus-vrm-history/service $SERVICE_DIR/dbus-vrm-history" >> "$RC_LOCAL"
|
|
echo "fi" >> "$RC_LOCAL"
|
|
fi
|
|
|
|
echo "6. Activating..."
|
|
sleep 2
|
|
|
|
echo ""
|
|
echo "=================================================="
|
|
echo "Installation complete!"
|
|
echo "=================================================="
|
|
echo ""
|
|
echo "Configure your VRM token:"
|
|
echo " dbus -y com.victronenergy.vrmhistory /Config/Token SetValue 'your-token'"
|
|
echo ""
|
|
echo "MQTT: N/<vrm-id>/vrmhistory/0/..."
|
|
echo ""
|