Created scripts for updating venus and cerbo installations

Fixed bug with number of files in dbus script
This commit is contained in:
Noe 2024-07-01 17:12:34 +02:00
parent a602fc5eac
commit 02037ab765
7 changed files with 105 additions and 12 deletions

View File

@ -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)

View File

@ -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

View File

@ -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:

View File

@ -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
#

View File

@ -291,8 +291,12 @@ function BatteryView(props: BatteryViewProps) {
width: '10%',
textAlign: 'center',
backgroundColor:
battery.AverageTemperature.value > 270
battery.AverageTemperature.value > 300
? '#FF033E'
: battery.AverageTemperature.value > 280
? '#ffbf00'
: battery.AverageTemperature.value < 245
? '#008FFB'
: '#32CD32'
}}
>

View File

@ -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)) {

View File

@ -92,10 +92,10 @@ function SalidomoInstallationTabs() {
/>
)
},
{
value: 'overview',
label: <FormattedMessage id="overview" defaultMessage="Overview" />
},
// {
// value: 'overview',
// label: <FormattedMessage id="overview" defaultMessage="Overview" />
// },
{
value: 'log',
label: <FormattedMessage id="log" defaultMessage="Log" />