Skip to content

Commit ba9e908

Browse files
authored
Merge 3033b52 into f99109d
2 parents f99109d + 3033b52 commit ba9e908

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

data/cmdvartab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ CMDDESC bypass.start "Put the UPS in bypass mode"
238238
CMDDESC bypass.stop "Take the UPS out of bypass mode"
239239
CMDDESC ecomode.enable "Put UPS in High Efficiency (aka ECO) mode"
240240
CMDDESC ecomode.disable "Take the UPS out of High Efficiency (aka ECO) mode"
241+
CMDDESC ecomode.start.auto "Put UPS in Bypass mode then High Efficiency (aka ECO) mode"
241242
CMDDESC essmode.enable "Put UPS in Energy Saver System (aka ESS) mode"
242243
CMDDESC essmode.disable "Take the UPS out of Energy Saver System (aka ESS) mode"
243244
CMDDESC reset.input.minmax "Reset minimum and maximum input voltage status"

docs/nut-names.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ Instant commands
875875
| bypass.stop | Take the UPS out of bypass mode
876876
| ecomode.enable | Put UPS in High Efficiency (aka ECO) mode
877877
| ecomode.disable | Take the UPS out of High Efficiency (aka ECO) mode
878+
| ecomode.start.auto | Put UPS in Bypass mode then High Efficiency (aka ECO) mode
878879
| essmode.enable | Put UPS in Energy Saver System (aka ESS) mode
879880
| essmode.disable | Take the UPS out of Energy Saver System (aka ESS) mode
880881
| reset.input.minmax | Reset minimum and maximum input voltage status

drivers/mge-hid.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,51 @@ static info_lkp_t eaton_input_bypass_mode_off_info[] = {
10251025
{ 0, NULL, NULL, NULL }
10261026
};
10271027

1028+
/* Function to start ECO(HE) Mode automatically instead of manually starting Bypass and then ECO(HE) Mode */
1029+
static const char *eaton_input_eco_mode_auto_on_fun(double value)
1030+
{
1031+
const char *bypass_switch_off_str = NULL;
1032+
const char *bypass_switch_on_str = NULL;
1033+
const char *eco_switchable_str = NULL;
1034+
1035+
NUT_UNUSED_VARIABLE(value);
1036+
1037+
/* Check if input.bypass.switch.on is disabled and set it to 'on' */
1038+
bypass_switch_on_str = dstate_getinfo("input.bypass.switch.on");
1039+
if (!strcmp(bypass_switch_on_str, "disabled")) {
1040+
setvar("input.bypass.switch.on", "on");
1041+
} else {
1042+
upsdebugx(1, "Bypass switch on state is: %s , must be disabled before switching on", bypass_switch_on_str);
1043+
return NULL;
1044+
}
1045+
1046+
/* Check if input.eco.switchable is normal and set it to 'ECO' */
1047+
eco_switchable_str = dstate_getinfo("input.eco.switchable");
1048+
if (!strcmp(eco_switchable_str, "normal")) {
1049+
setvar("input.eco.switchable", "ECO");
1050+
} else {
1051+
upsdebugx(1, "ECO switch state is: %s , must be normal before switching to ECO", eco_switchable_str);
1052+
return NULL;
1053+
}
1054+
1055+
/* Check if input.bypass.switch.off is disabled and set it to 'off' */
1056+
bypass_switch_off_str = dstate_getinfo("input.bypass.switch.off");
1057+
if (!strcmp(bypass_switch_off_str, "disabled")) {
1058+
setvar("input.bypass.switch.off", "off");
1059+
} else {
1060+
upsdebugx(1, "Bypass switch off state is: %s , must be disabled before switching off", bypass_switch_off_str);
1061+
return NULL;
1062+
}
1063+
upsdebugx(1, "%s: ECO Mode was enabled after switching to Bypass Mode", __func__);
1064+
return NULL;
1065+
}
1066+
1067+
/* High Efficiency (aka ECO) mode for auto start command */
1068+
static info_lkp_t eaton_input_eco_mode_auto_on_info[] = {
1069+
{ 1, "dummy", eaton_input_eco_mode_auto_on_fun, NULL },
1070+
{ 0, NULL, NULL, NULL }
1071+
};
1072+
10281073
/* Determine country using UPS.PowerSummary.Country.
10291074
* If not present:
10301075
* if PowerConverter.Output.Voltage >= 200 => "Europe"
@@ -1957,6 +2002,8 @@ static hid_info_t mge_hid2nut[] =
19572002
{ "ecomode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_mode_info },
19582003
{ "essmode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "2", HU_TYPE_CMD, NULL },
19592004
{ "essmode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, NULL },
2005+
/* Command to switch ECO(HE) Mode with switch to Automatic Bypass Mode on befor */
2006+
{ "ecomode.start.auto", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_eco_mode_auto_on_info },
19602007

19612008
/* Command to switch Automatic Bypass Mode On/Off */
19622009
{ "bypass.start", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "1", HU_TYPE_CMD, eaton_input_bypass_mode_on_info },

0 commit comments

Comments
 (0)