2 Commits

Author SHA1 Message Date
830b29b569 * Sat May 24 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- fix issue with standalone and netserver mode [SME: 13012]
2025-05-24 16:09:49 -04:00
e235701fe2 * Sun May 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- add pollinterval setting [SME: 13006]
- update config for Nut 2.8.2 [SME: 12657]
2025-05-18 01:01:00 -04:00
5 changed files with 28 additions and 15 deletions

View File

@@ -3,5 +3,5 @@ MODE={
return "none" unless ( ($nut{"status"}||"disabled") eq "enabled");
# if Master no => netclient
# if Master yes => standalone or netserver
$nut{mode} || "standalone";
$nut{Mode} || "standalone";
}

View File

@@ -1,16 +1,20 @@
{
my $poll = $nut{pollInterval} || '2';
if ($poll ne '2') {
$OUT .= "pollinterval = $poll\n";
}
my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
foreach my $ups ( sort {$a cmp $b} @upses )
{
my $nnut = ${$ups};
my $status = $nnut{status} || "disabled";
my $status = ${"$ups"}{status} || "disabled";
next if $status eq "disabled";
my ($name )= $ups =~ /^nut-driver\@(.*)$/ ;
my $model = $nnut{Model} || "usbhid-ups";
my $device = $nnut{Device} || "auto"; #"/var/lib/ups/hiddev0";
my $type = $nnut{Type};
my $mfr = $nnut{mfr};
my $mdl = $nnut{mdl};
my $model = ${"$ups"}{Model} || "usbhid-ups";
my $device = ${"$ups"}{Device} || "auto"; #"/var/lib/ups/hiddev0";
my $type = ${"$ups"}{Type};
my $mfr = ${"$ups"}{mfr};
my $mdl = ${"$ups"}{mdl};
$OUT .= "[$name]\n";
$OUT .= "\tdriver = $model\n";
if ($model eq 'genericups')

View File

@@ -253,7 +253,10 @@ sub get_ups_status {
} elsif ($nutmode eq 'netclient'){
return $c->get_status_from_device($cdb->get_prop('nut','ClientUPS'));
} else {
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS'));
# TODO: could enumerate all the upses using
# my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
# we will only use the default first one for the moment nut-driver@ups for ups named "ups"
return $c->get_status_from_device("ups");
}
}

View File

@@ -1,13 +1,16 @@
$(document).ready(function() {
function toggleUPSClasses() {
var selectedOption = $('#Nutmode_select').val();
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
$('.masterups').toggle(selectedOption === 'netserver' || selectedOption === 'standalone'); // Show/Hide masterups based on Net Server or Standalone
$('.secondaryups').toggle(selectedOption === 'netserver' ); // Show/Hide Secondary logins for net server
$('.slaveups').toggle(selectedOption === 'netclient'); // Show/Hide slaveups based on Net Client
$('.generics').toggle(selectedOption !== 'netclient' && upsModelValue === 'genericups' );
// Enable/Disable inputs based on the selected option
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
$('.generics input').prop('disabled', selectedOption === 'netclient');
}
function toggleGenerics() {

View File

@@ -4,7 +4,7 @@ Summary: SME server - nut UPS interaction module
%define name smeserver-nutUPS
Name: %{name}
%define version 11.0.0
%define release 9
%define release 11
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -26,12 +26,15 @@ A module which configures the Network UPS Tools suite for operation with
the SME server software.
%changelog
* Sat May 24 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- fix issue with standalone and netserver mode [SME: 13012]
* Sun May 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- add pollinterval setting [SME: 13006]
- update config for Nut 2.8.2 [SME: 12657]
* Tue Mar 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- update config for Nut 2.8.2 [SME: 12657]
TODO review master/slave mode
TODO convert master/slave to primary/secondary
TODO convert to new config data + migrate
TODO event and action
* Wed Mar 05 2025 Brian Read <brianr@koozali.org> 11.0.0-8.sme
- typo in lex file [SME: 12949]