Skip to content

Commit 6d160d6

Browse files
authored
Merge 4fd9856 into 093e44b
2 parents 093e44b + 4fd9856 commit 6d160d6

3 files changed

Lines changed: 23 additions & 19 deletions

File tree

data/cmdvartab

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ CMDDESC bypass.start "Put the UPS in Bypass mode"
260260
CMDDESC bypass.stop "Take the UPS out of Bypass mode"
261261
CMDDESC experimental.ecomode.enable "Put UPS in High Efficiency (aka ECO) mode"
262262
CMDDESC experimental.ecomode.disable "Take the UPS out of High Efficiency (aka ECO) mode"
263-
CMDDESC experimental.ecomode.start.auto "Put UPS in Bypass mode then High Efficiency (aka ECO) mode"
264-
CMDDESC experimental.ecomode.stop.auto "Take the UPS out of High Efficiency (aka ECO) mode after exiting Bypass mode"
263+
CMDDESC experimental.ecomode.auto "Put UPS in Bypass mode then High Efficiency (aka ECO) mode"
265264
CMDDESC experimental.essmode.enable "Put UPS in Energy Saver System (aka ESS) mode"
266265
CMDDESC experimental.essmode.disable "Take the UPS out of Energy Saver System (aka ESS) mode"
267266
CMDDESC experimental.test.beeper.start "Start testing the UPS beeper"

docs/nut-names.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ to last as part of NUT standard protocol in the long run.
10591059
| Put UPS in High Efficiency (aka ECO) mode
10601060
| experimental.ecomode.disable | usbhid-ups => mge-hid (Eaton/MGE)
10611061
| Take the UPS out of High Efficiency (aka ECO) mode
1062-
| experimental.ecomode.start.auto | usbhid-ups => mge-hid (Eaton/MGE)
1062+
| experimental.ecomode.auto | usbhid-ups => mge-hid (Eaton/MGE)
10631063
| Put UPS in Bypass mode then High Efficiency (aka ECO) mode
10641064
| experimental.ecomode.stop.auto | usbhid-ups => mge-hid (Eaton/MGE)
10651065
| Take the UPS out of High Efficiency (aka ECO) mode after exiting Bypass mode

drivers/mge-hid.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ static const char *eaton_input_bypass_check_range(double value)
10621062
NUT_STRARG(out_frequency_nominal_str));
10631063

10641064
/* Disable Bypass mode switching, do not enter Bypass mode */
1065-
dstate_setinfo("input.bypass.switch.on", "disabled");
1065+
dstate_setinfo("input.bypass.switch.off", "off");
10661066
upsdebugx(1, "%s: Disable Bypass mode due to missing input/output variables.", __func__);
10671067
return NULL;
10681068
}
@@ -1131,7 +1131,7 @@ static const char *eaton_input_bypass_check_range(double value)
11311131
upsdebugx(1, "Input Bypass frequency is outside Bypass transfer limits: %.1f Hz", bypass_frequency);
11321132
}
11331133
/* Disable Bypass mode switching, do not enter Bypass mode */
1134-
dstate_setinfo("input.bypass.switch.on", "disabled");
1134+
dstate_setinfo("input.bypass.switch.off", "off");
11351135
upsdebugx(1, "%s: Disable Bypass mode due to input conditions being outside the transfer limits.", __func__);
11361136
return NULL;
11371137
}
@@ -1157,12 +1157,10 @@ static const char *eaton_input_eco_mode_auto_on_fun(double value)
11571157
const char *bypass_switch_on_str = NULL;
11581158
const char *eco_switchable_str = NULL;
11591159

1160-
NUT_UNUSED_VARIABLE(value);
1161-
11621160
/* Check if input.bypass.switch.on is disabled and set it to 'on' */
11631161
bypass_switch_on_str = dstate_getinfo("input.bypass.switch.on");
11641162
if (!strcmp(bypass_switch_on_str, "disabled")) {
1165-
setvar("input.bypass.switch.on", "on");
1163+
bypass_switch_on_str = eaton_input_bypass_check_range(value);
11661164
} else {
11671165
upsdebugx(1, "Bypass switch on state is: %s , must be disabled before switching on", bypass_switch_on_str);
11681166
return NULL;
@@ -1171,14 +1169,14 @@ static const char *eaton_input_eco_mode_auto_on_fun(double value)
11711169
/* Check if input.eco.switchable is normal and set it to 'ECO' */
11721170
eco_switchable_str = dstate_getinfo("input.eco.switchable");
11731171
if (!strcmp(eco_switchable_str, "normal")) {
1174-
setvar("input.eco.switchable", "ECO");
1172+
eco_switchable_str = eaton_input_eco_mode_check_range(value);
11751173
} else {
11761174
upsdebugx(1, "ECO switch state is: %s , must be normal before switching to ECO", eco_switchable_str);
11771175
return NULL;
11781176
}
11791177

11801178
upsdebugx(1, "%s: ECO Mode was enabled after switching to Bypass Mode", __func__);
1181-
return NULL;
1179+
return eco_switchable_str;
11821180
}
11831181

11841182
/* Function to stop ECO(HE) Mode automatically instead of manually stoping Bypass and then Online Mode */
@@ -1202,6 +1200,7 @@ static const char *eaton_input_eco_mode_auto_off_fun(double value)
12021200
eco_switchable_str = dstate_getinfo("input.eco.switchable");
12031201
if (!strcmp(eco_switchable_str, "ECO")) {
12041202
setvar("input.eco.switchable", "normal");
1203+
buzzmode_set("vendor:mge-hid:normal");
12051204
} else {
12061205
upsdebugx(1, "ECO switch state is: %s , must be ECO before switching to normal", eco_switchable_str);
12071206
return NULL;
@@ -1213,8 +1212,9 @@ static const char *eaton_input_eco_mode_auto_off_fun(double value)
12131212

12141213
/* High Efficiency (aka ECO) mode for auto start/stop commands */
12151214
static info_lkp_t eaton_input_eco_mode_auto_on_off_info[] = {
1216-
{ 1, "dummy", eaton_input_eco_mode_auto_on_fun, NULL },
1217-
{ 0, "dummy", eaton_input_eco_mode_auto_off_fun, NULL },
1215+
{ 0, "normal", eaton_input_eco_mode_auto_off_fun, NULL },
1216+
{ 1, "ECO", eaton_input_eco_mode_auto_on_fun, NULL },
1217+
{ 2, "ESS", NULL, NULL },
12181218
{ 0, NULL, NULL, NULL }
12191219
};
12201220

@@ -2043,6 +2043,10 @@ static hid_info_t mge_hid2nut[] =
20432043
/* ECO(HE), ESS Mode switch, to use when 'input.bypass.switch.on' is on */
20442044
{ "input.eco.switchable", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[5].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_eco_mode_on_off_info },
20452045

2046+
/* Needs to be Tested */
2047+
/* Command to switch ECO(HE) Mode on/off with switch to Automatic Bypass Mode on/off before */
2048+
{ "experimental.ecomode.auto", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[5].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_eco_mode_auto_on_off_info },
2049+
20462050
/* Auto Bypass Mode on/off, to use when 'input.transfer.bypass.forced' is enabled */
20472051
{ "input.bypass.switch.on", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_bypass_mode_on_info },
20482052
{ "input.bypass.switch.off", ST_FLAG_RW | ST_FLAG_STRING, 12, "UPS.PowerConverter.Input.[2].SwitchOffControl", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_bypass_mode_off_info },
@@ -2155,18 +2159,19 @@ static hid_info_t mge_hid2nut[] =
21552159
{ "outlet.2.load.on", 0, 0, "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup", NULL, "0", HU_TYPE_CMD, NULL },
21562160

21572161
/* Command to switch ECO(HE), ESS Mode */
2158-
{ "experimental.ecomode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, eaton_input_eco_mode_on_off_info },
2159-
{ "experimental.ecomode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_eco_mode_on_off_info },
2160-
{ "experimental.essmode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "2", HU_TYPE_CMD, eaton_input_eco_mode_on_off_info },
2161-
{ "experimental.essmode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, eaton_input_eco_mode_on_off_info },
2162-
/* Command to switch ECO(HE) Mode with switch to Automatic Bypass Mode on before */
2162+
{ "experimental.ecomode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, NULL },
2163+
{ "experimental.ecomode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, NULL },
2164+
{ "experimental.essmode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "2", HU_TYPE_CMD, NULL },
2165+
{ "experimental.essmode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, NULL },
2166+
2167+
/* Command to switch ECO(HE) Mode with switch to Automatic Bypass Mode on before */
21632168
{ "experimental.ecomode.start.auto", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_eco_mode_auto_on_off_info },
21642169
/* Command to switch from ECO(HE) Mode with switch from Automatic Bypass Mode on before */
21652170
{ "experimental.ecomode.stop.auto", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, eaton_input_eco_mode_auto_on_off_info },
21662171

21672172
/* Command to switch Automatic Bypass Mode on/off */
2168-
{ "bypass.start", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "1", HU_TYPE_CMD, eaton_input_bypass_mode_on_info },
2169-
{ "bypass.stop", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOffControl", NULL, "1", HU_TYPE_CMD, eaton_input_bypass_mode_off_info },
2173+
{ "bypass.start", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "1", HU_TYPE_CMD, NULL },
2174+
{ "bypass.stop", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOffControl", NULL, "1", HU_TYPE_CMD, NULL },
21702175

21712176
/* end of structure. */
21722177
{ NULL, 0, 0, NULL, NULL, NULL, 0, NULL }

0 commit comments

Comments
 (0)