Created scripts for updating venus and cerbo installations
Fixed bug with number of files in dbus script
This commit is contained in:
parent
a602fc5eac
commit
02037ab765
|
@ -915,8 +915,8 @@ def create_batch_of_csv_files():
|
||||||
# sort csv files by creation time
|
# sort csv files by creation time
|
||||||
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
||||||
|
|
||||||
# keep the 15 MOST RECENT FILES
|
# keep the 30 MOST RECENT FILES
|
||||||
recent_csv_files = csv_files[-15:] if len(csv_files) > 15 else csv_files
|
recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
||||||
|
|
||||||
# get the name of the first csv file
|
# get the name of the first csv file
|
||||||
if not csv_files:
|
if not csv_files:
|
||||||
|
@ -1025,7 +1025,7 @@ def create_update_task(modbus, dbus, batteries, signals, csv_signals, main_loop)
|
||||||
ALLOW = True
|
ALLOW = True
|
||||||
alive = update(modbus, batteries, dbus, signals, csv_signals)
|
alive = update(modbus, batteries, dbus, signals, csv_signals)
|
||||||
elapsed_time = time.time() - start_time
|
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()
|
create_batch_of_csv_files()
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
#alive = update_for_testing(modbus, batteries, dbus, signals, csv_signals)
|
#alive = update_for_testing(modbus, batteries, dbus, signals, csv_signals)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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)
|
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()
|
create_batch_of_csv_files()
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
||||||
|
@ -590,8 +590,8 @@ def create_batch_of_csv_files():
|
||||||
# sort csv files by creation time
|
# sort csv files by creation time
|
||||||
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
||||||
|
|
||||||
# keep the 15 MOST RECENT FILES
|
# keep the 30 MOST RECENT FILES
|
||||||
recent_csv_files = csv_files[-15:] if len(csv_files) > 15 else csv_files
|
recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
||||||
|
|
||||||
# get the name of the first csv file
|
# get the name of the first csv file
|
||||||
if not csv_files:
|
if not csv_files:
|
||||||
|
|
|
@ -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
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -291,8 +291,12 @@ function BatteryView(props: BatteryViewProps) {
|
||||||
width: '10%',
|
width: '10%',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
battery.AverageTemperature.value > 270
|
battery.AverageTemperature.value > 300
|
||||||
? '#FF033E'
|
? '#FF033E'
|
||||||
|
: battery.AverageTemperature.value > 280
|
||||||
|
? '#ffbf00'
|
||||||
|
: battery.AverageTemperature.value < 245
|
||||||
|
? '#008FFB'
|
||||||
: '#32CD32'
|
: '#32CD32'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
@ -93,6 +93,7 @@ function Installation(props: singleInstallationProps) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
|
console.log('NUMBER OF FILES=' + Object.keys(res).length);
|
||||||
|
|
||||||
while (continueFetching.current) {
|
while (continueFetching.current) {
|
||||||
for (const timestamp of Object.keys(res)) {
|
for (const timestamp of Object.keys(res)) {
|
||||||
|
|
|
@ -92,10 +92,10 @@ function SalidomoInstallationTabs() {
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
value: 'overview',
|
// value: 'overview',
|
||||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
// label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
value: 'log',
|
value: 'log',
|
||||||
label: <FormattedMessage id="log" defaultMessage="Log" />
|
label: <FormattedMessage id="log" defaultMessage="Log" />
|
||||||
|
|
Loading…
Reference in New Issue