update aggregator service in Venus and Cerbo

This commit is contained in:
Yinyin Liu 2024-07-26 14:30:29 +02:00
parent 602470abc5
commit 5c629ed6b2
15 changed files with 69 additions and 54 deletions

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec multilog t s25000 n4 /var/log/aggregator

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "*** starting aggregator ***"
exec 2>&1
exec softlimit -d 100000000 -s 1000000 -a 100000000 /opt/victronenergy/dbus-fzsonick-48tl/aggregator.py

View File

@ -259,7 +259,7 @@ class Aggregator:
return 0 return 0
if __name__ == "__main__": if __name__ == "__main__":
print("Aggregator has started AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") print("Aggregator has started")
def run_hourly_manager(): def run_hourly_manager():
Aggregator.hourly_data_aggregation_manager() Aggregator.hourly_data_aggregation_manager()

View File

@ -5,11 +5,6 @@
app="/opt/victronenergy/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py" app="/opt/victronenergy/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py"
args="$tty" args="$tty"
# Start aggregator.py in the background
#/opt/victronenergy/dbus-fzsonick-48tl/aggregator.py &
# Start dbus-fzsonick-48tl.py using the start command # Start dbus-fzsonick-48tl.py using the start command
start "$args" start $args
# Wait for all background processes to finish
#wait

View File

@ -45,10 +45,19 @@ cp -r "$source_dir" "$destination_dir_upper"
echo "Changing MPPT network mode to 0..." echo "Changing MPPT network mode to 0..."
sed -i "s|('/Link/NetworkMode', [^)]*)|('/Link/NetworkMode', 0)|g" /opt/victronenergy/dbus-systemcalc-py/delegates/dvcc.py sed -i "s|('/Link/NetworkMode', [^)]*)|('/Link/NetworkMode', 0)|g" /opt/victronenergy/dbus-systemcalc-py/delegates/dvcc.py
# Set VPN # Set aggregator service symlink
echo "Running VPN service..." echo "Creating symbolic link to aggregator service..."
find /data/innovenergy/openvpn -type f -exec chmod 777 {} \; aggregator_service_path="/data/aggregator"
/data/innovenergy/openvpn/service/run # aggregator_symlink_path="/opt/victronenergy/service"
#nohup /data/innovenergy/openvpn/service/run & aggregator_symlink_path="/service"
ln -s "$aggregator_service_path" "$aggregator_symlink_path"
# Set VPN service symlink
echo "Creating symbolic link to VPN service..."
vpn_service_path="/data/innovenergy/openvpn/service"
# vpn_symlink_path="/opt/victronenergy/service/openvpn"
vpn_symlink_path="/service/openvpn"
ln -s "$vpn_service_path" "$vpn_symlink_path"
exit 0 exit 0

View File

@ -97,6 +97,7 @@ async def upload_files(remote_host,which_file):
file_location_mappings = { file_location_mappings = {
"rc.local": "/data/", "rc.local": "/data/",
"dbus-fzsonick-48tl": "/data/", "dbus-fzsonick-48tl": "/data/",
"aggregator": "/data/",
"service": "/data/innovenergy/openvpn/", "service": "/data/innovenergy/openvpn/",
"openvpn": "/data/innovenergy/openvpn/", "openvpn": "/data/innovenergy/openvpn/",
"pika-0.13.1": "/data/innovenergy/" "pika-0.13.1": "/data/innovenergy/"

View File

@ -6,6 +6,7 @@ root_password='salidomo'
set -e set -e
battery_file_path="./CerboReleaseFiles/dbus-fzsonick-48tl" battery_file_path="./CerboReleaseFiles/dbus-fzsonick-48tl"
cerbo_release_file_path="./CerboReleaseFiles"
echo -e "\n============================ Deploy ============================\n" echo -e "\n============================ Deploy ============================\n"
# Berger 10.2.2.36 and Polycom 10.2.4.96 are Cerbo with fork usb0 # Berger 10.2.2.36 and Polycom 10.2.4.96 are Cerbo with fork usb0
# ip_addresses_usb0=("10.2.2.118" "10.2.4.155" "10.2.3.244" "10.2.4.127" "10.2.2.36" "10.2.4.96") # ip_addresses_usb0=("10.2.2.118" "10.2.4.155" "10.2.3.244" "10.2.4.127" "10.2.2.36" "10.2.4.96")
@ -15,12 +16,14 @@ ip_addresses_usb1=("10.2.0.179" "10.2.1.241" )
for ip_address in "${ip_addresses_usb0[@]}"; do for ip_address in "${ip_addresses_usb0[@]}"; do
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0"
scp "${battery_file_path}/start.sh" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/" scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${cerbo_release_file_path}/rc.local" "root@"$ip_address":/data"
scp -r "${cerbo_release_file_path}/aggregator" "root@"$ip_address":/data"
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0"
echo "Deployed and ran commands on $ip_address" echo "Deployed and ran commands on $ip_address"
@ -28,12 +31,14 @@ done
for ip_address in "${ip_addresses_usb1[@]}"; do for ip_address in "${ip_addresses_usb1[@]}"; do
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1"
scp "${battery_file_path}/start.sh" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/" # scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${cerbo_release_file_path}/rc.local" "root@"$ip_address":/data"
# scp -r "${cerbo_release_file_path}/aggregator" "root@"$ip_address":/data"
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1"
echo "Deployed and ran commands on $ip_address" echo "Deployed and ran commands on $ip_address"

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec multilog t s25000 n4 /var/log/aggregator

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "*** starting aggregator ***"
exec 2>&1
exec softlimit -d 100000000 -s 1000000 -a 100000000 /opt/victronenergy/dbus-fzsonick-48tl/aggregator.py

View File

@ -18,12 +18,6 @@ CSV_DIR = "/data/csv_files/"
HOURLY_DIR = "/data/csv_files/HourlyData" HOURLY_DIR = "/data/csv_files/HourlyData"
DAILY_DIR = "/data/csv_files/DailyData" DAILY_DIR = "/data/csv_files/DailyData"
# S3 Credentials
#S3BUCKET = "6-c0436b6a-d276-4cd8-9c44-1eae86cf5d0e"
#S3KEY = "EXO2a6cd837ae9279271b1710af"
#S3SECRET = "IAK2wc7mL0HWD9LHFeiv1nl5jvousOLLAHKCQwmwniI"
print("start with the correct credentials") print("start with the correct credentials")
S3BUCKET = cfg.S3BUCKET S3BUCKET = cfg.S3BUCKET
@ -270,8 +264,8 @@ class Aggregator:
return 0 return 0
if __name__ == "__main__": if __name__ == "__main__":
print("aggregator has started aAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") print("aggregator has started")
#exit(0)
def run_hourly_manager(): def run_hourly_manager():
Aggregator.hourly_data_aggregation_manager() Aggregator.hourly_data_aggregation_manager()

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
exec 2>&1 exec 2>&1
softlimit -d 100000000 -s 1000000 -a 100000000 /opt/innovenergy/dbus-fzsonick-48tl/start.sh exec softlimit -d 100000000 -s 1000000 -a 100000000 /opt/innovenergy/dbus-fzsonick-48tl/start.sh TTY

View File

@ -5,12 +5,6 @@
app="/opt/innovenergy/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py" app="/opt/innovenergy/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py"
args="$tty" args="$tty"
# Start aggregator.py in the background
#/opt/innovenergy/dbus-fzsonick-48tl/aggregator.py &
# Start dbus-fzsonick-48tl.py using the start command # Start dbus-fzsonick-48tl.py using the start command
start "$args" start $args
# Wait for all background processes to finish
#wait

View File

@ -44,10 +44,10 @@ cp -r "$source_dir" "$destination_dir_upper"
# Set toggle calibration charge button # Set toggle calibration charge button
cp /data/PageChargingStrategy.qml /opt/victronenergy/gui/qml cp /data/PageChargingStrategy.qml /opt/victronenergy/gui/qml
# # Set VPN # Set aggregator service symlink
# echo "Running VPN service..." echo "Creating symbolic link to aggregator service..."
# find /opt/innovenergy/openvpn -type f -exec chmod 777 {} \; aggregator_service_path="/data/aggregator"
# /opt/innovenergy/openvpn/service/run aggregator_symlink_path="/service"
#nohup /opt/innovenergy/openvpn/service/run & ln -s "$aggregator_service_path" "$aggregator_symlink_path"
exit 0 exit 0

View File

@ -50,6 +50,7 @@ async def upload_files(remote_host):
file_location_mappings = { file_location_mappings = {
"rc.local": "/data/", "rc.local": "/data/",
"dbus-fzsonick-48tl": "/data/", "dbus-fzsonick-48tl": "/data/",
"aggregator": "/data/",
"PageChargingStrategy.qml": "/data/", "PageChargingStrategy.qml": "/data/",
"pika-0.13.1": "/data/innovenergy/" "pika-0.13.1": "/data/innovenergy/"
} }

View File

@ -19,15 +19,16 @@ ip_addresses_usb1=("10.2.1.35")
for ip_address in "${ip_addresses_usb0[@]}"; do for ip_address in "${ip_addresses_usb0[@]}"; do
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/" scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data/" scp "${battery_file_path}/service/run" "root@"$ip_address":/data/dbus-fzsonick-48tl/service"
scp "${venus_release_file_path}/PageChargingStrategy.qml" "root@"$ip_address":/opt/victronenergy/gui/qml" scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data"
scp "${venus_release_file_path}/PageChargingStrategy.qml" "root@"$ip_address":/data/" scp -r "${venus_release_file_path}/aggregator" "root@"$ip_address":/data"
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0"
# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0"
echo "Deployed and ran commands on $ip_address" echo "Deployed and ran commands on $ip_address"
@ -35,16 +36,16 @@ done
for ip_address in "${ip_addresses_usb1[@]}"; do for ip_address in "${ip_addresses_usb1[@]}"; do
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" scp "${battery_file_path}/aggregator.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
# scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/" scp "${battery_file_path}/start.sh" "root@"$ip_address":/data/dbus-fzsonick-48tl/"
scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data/" scp "${battery_file_path}/service/run" "root@"$ip_address":/data/dbus-fzsonick-48tl/service"
scp "${venus_release_file_path}/PageChargingStrategy.qml" "root@"$ip_address":/opt/victronenergy/gui/qml" scp "${venus_release_file_path}/rc.local" "root@"$ip_address":/data"
scp "${venus_release_file_path}/PageChargingStrategy.qml" "root@"$ip_address":/data/" scp -r "${venus_release_file_path}/aggregator" "root@"$ip_address":/data"
ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1" # ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1"
echo "Deployed and ran commands on $ip_address" echo "Deployed and ran commands on $ip_address"