* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-7.sme

- Enhance UPS Status screen [SME: ]
This commit is contained in:
2025-03-03 15:54:20 +00:00
parent 6592179f55
commit b8690bf214
4 changed files with 38 additions and 24 deletions

View File

@@ -77,7 +77,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
#'Data1'=>'Data for STATUS', #Example
# fields from Inputs in STATUS $fields['STATUS']
'UPSStatus'=>$c->get_ups_status(),
'ups_data' => $c->get_ups_status_as_hash()
);
return %ret;
}
@@ -239,6 +239,16 @@ sub get_ups_status {
}
}
sub get_ups_status_as_hash {
$c = shift;
$string = $c->get_ups_status();
my %hash;
while ($string =~ /^(.+?):\s*(.+)$/mg) {
$hash{$1} = $2;
}
return \%hash
}
sub get_status_from_device {
my ($c,$device) = @_;
my $command = '/usr/bin/upsc';