From 02037ab765d003911fd05069ea20f0e4c8e6e17b Mon Sep 17 00:00:00 2001 From: Noe Date: Mon, 1 Jul 2024 17:12:34 +0200 Subject: [PATCH] Created scripts for updating venus and cerbo installations Fixed bug with number of files in dbus script --- .../dbus-fzsonick-48tl/dbus-fzsonick-48tl.py | 6 +-- .../update_all_cerbo_installations.sh | 43 ++++++++++++++++++ .../dbus-fzsonick-48tl/dbus-fzsonick-48tl.py | 6 +-- .../update_all_venus_installations.sh | 45 +++++++++++++++++++ .../dashboards/BatteryView/BatteryView.tsx | 8 +++- .../SalidomoInstallations/Installation.tsx | 1 + .../SalidomoInstallations/index.tsx | 8 ++-- 7 files changed, 105 insertions(+), 12 deletions(-) create mode 100755 firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/update_all_cerbo_installations.sh create mode 100755 firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/update_all_venus_installations.sh diff --git a/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py b/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py index 6503279a4..2cfa3013b 100755 --- a/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py +++ b/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py @@ -915,8 +915,8 @@ def create_batch_of_csv_files(): # sort csv files by creation time csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x))) - # keep the 15 MOST RECENT FILES - recent_csv_files = csv_files[-15:] if len(csv_files) > 15 else csv_files + # keep the 30 MOST RECENT FILES + recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files # get the name of the first csv file if not csv_files: @@ -1025,7 +1025,7 @@ def create_update_task(modbus, dbus, batteries, signals, csv_signals, main_loop) ALLOW = True alive = update(modbus, batteries, dbus, signals, csv_signals) elapsed_time = time.time() - start_time - if count_files_in_folder(CSV_DIR) >= 15 and elapsed_time >= 60: + if elapsed_time >= 60: create_batch_of_csv_files() start_time = time.time() #alive = update_for_testing(modbus, batteries, dbus, signals, csv_signals) diff --git a/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/update_all_cerbo_installations.sh b/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/update_all_cerbo_installations.sh new file mode 100755 index 000000000..054449aae --- /dev/null +++ b/firmware/Cerbo_Release/CerboReleaseFiles/dbus-fzsonick-48tl/update_all_cerbo_installations.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +username='root' +root_password='salidomo' + +set -e + + +echo -e "\n============================ Deploy ============================\n" +ip_addresses_usb0=("10.2.2.118" "10.2.4.155" "10.2.3.244" "10.2.4.127") +ip_addresses_usb1=("10.2.0.179" ) + + +for ip_address in "${ip_addresses_usb0[@]}"; do + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0" + + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/" + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0" + + + echo "Deployed and ran commands on $ip_address" +done + +for ip_address in "${ip_addresses_usb1[@]}"; do + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1" + + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/" + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1" + + + echo "Deployed and ran commands on $ip_address" +done + + + + + diff --git a/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py b/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py index a0e0883fd..f3ec1a0ca 100755 --- a/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py +++ b/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/dbus-fzsonick-48tl.py @@ -552,7 +552,7 @@ def create_update_task(modbus, service, batteries): create_csv_files(csv_signals, statuses, node_numbers, alarms_number_list, warnings_number_list) num_files_in_csv_dir = count_files_in_folder(CSV_DIR) - if num_files_in_csv_dir >= 15 and elapsed_time >= 60: + if elapsed_time >= 60: create_batch_of_csv_files() start_time = time.time() @@ -590,8 +590,8 @@ def create_batch_of_csv_files(): # sort csv files by creation time csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x))) - # keep the 15 MOST RECENT FILES - recent_csv_files = csv_files[-15:] if len(csv_files) > 15 else csv_files + # keep the 30 MOST RECENT FILES + recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files # get the name of the first csv file if not csv_files: diff --git a/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/update_all_venus_installations.sh b/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/update_all_venus_installations.sh new file mode 100755 index 000000000..76a9c0a31 --- /dev/null +++ b/firmware/Venus_Release/VenusReleaseFiles/dbus-fzsonick-48tl/update_all_venus_installations.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +username='root' +root_password='salidomo' + +set -e + + +echo -e "\n============================ Deploy ============================\n" +#ip_addresses_usb0=("10.2.0.155" "10.2.1.97" "10.2.0.104" "10.2.1.159" "10.2.0.224" "10.2.0.209" "10.2.2.36") +ip_addresses_usb0=("10.2.2.36") + +#ip_addresses_usb1=("10.2.1.35") + + +for ip_address in "${ip_addresses_usb0[@]}"; do + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB0" + + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" + scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/" + + ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB0" + + + echo "Deployed and ran commands on $ip_address" +done +# +#for ip_address in "${ip_addresses_usb1[@]}"; do +# +# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./stop-tty.sh ttyUSB1" +# +# scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/opt/victronenergy/dbus-fzsonick-48tl/" +# scp "dbus-fzsonick-48tl.py" "root@"$ip_address":/data/dbus-fzsonick-48tl/" +# +# ssh "$username"@"$ip_address" "cd /opt/victronenergy/serial-starter && echo '$root_password' | ./start-tty.sh ttyUSB1" +# +# +# echo "Deployed and ran commands on $ip_address" +#done +# + + + + diff --git a/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx b/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx index f012f281b..e01a7b65f 100644 --- a/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx @@ -291,9 +291,13 @@ function BatteryView(props: BatteryViewProps) { width: '10%', textAlign: 'center', backgroundColor: - battery.AverageTemperature.value > 270 + battery.AverageTemperature.value > 300 ? '#FF033E' - : '#32CD32 ' + : battery.AverageTemperature.value > 280 + ? '#ffbf00' + : battery.AverageTemperature.value < 245 + ? '#008FFB' + : '#32CD32' }} > {battery.AverageTemperature.value + diff --git a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx index 339bbeee9..95fde3885 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx @@ -93,6 +93,7 @@ function Installation(props: singleInstallationProps) { return false; } setConnected(true); + console.log('NUMBER OF FILES=' + Object.keys(res).length); while (continueFetching.current) { for (const timestamp of Object.keys(res)) { diff --git a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/index.tsx b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/index.tsx index a35b1a2c4..8b15fc5bd 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/index.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/index.tsx @@ -92,10 +92,10 @@ function SalidomoInstallationTabs() { /> ) }, - { - value: 'overview', - label: - }, + // { + // value: 'overview', + // label: + // }, { value: 'log', label: