@@ -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 }
@@ -1156,13 +1156,13 @@ static const char *eaton_input_eco_mode_auto_on_fun(double value)
11561156{
11571157 const char * bypass_switch_on_str = NULL ;
11581158 const char * eco_switchable_str = NULL ;
1159-
1160- NUT_UNUSED_VARIABLE ( value ) ;
1159+ const char * bypass_result = NULL ;
1160+ const char * ecomode_result = NULL ;
11611161
11621162 /* Check if input.bypass.switch.on is disabled and set it to 'on' */
11631163 bypass_switch_on_str = dstate_getinfo ("input.bypass.switch.on" );
11641164 if (!strcmp (bypass_switch_on_str , "disabled" )) {
1165- setvar ( "input.bypass.switch.on" , "on" );
1165+ bypass_result = eaton_input_bypass_check_range ( value );
11661166 } else {
11671167 upsdebugx (1 , "Bypass switch on state is: %s , must be disabled before switching on" , bypass_switch_on_str );
11681168 return NULL ;
@@ -1171,21 +1171,23 @@ static const char *eaton_input_eco_mode_auto_on_fun(double value)
11711171 /* Check if input.eco.switchable is normal and set it to 'ECO' */
11721172 eco_switchable_str = dstate_getinfo ("input.eco.switchable" );
11731173 if (!strcmp (eco_switchable_str , "normal" )) {
1174- setvar ( "input.eco.switchable" , "ECO" );
1174+ ecomode_result = eaton_input_eco_mode_check_range ( value );
11751175 } else {
11761176 upsdebugx (1 , "ECO switch state is: %s , must be normal before switching to ECO" , eco_switchable_str );
11771177 return NULL ;
11781178 }
11791179
11801180 upsdebugx (1 , "%s: ECO Mode was enabled after switching to Bypass Mode" , __func__ );
1181- return NULL ;
1181+ return ecomode_result ;
11821182}
11831183
11841184/* Function to stop ECO(HE) Mode automatically instead of manually stoping Bypass and then Online Mode */
11851185static const char * eaton_input_eco_mode_auto_off_fun (double value )
11861186{
11871187 const char * bypass_switch_off_str = NULL ;
11881188 const char * eco_switchable_str = NULL ;
1189+ const char * bypass_result = NULL ;
1190+ const char * ecomode_result = NULL ;
11891191
11901192 NUT_UNUSED_VARIABLE (value );
11911193
@@ -1213,8 +1215,9 @@ static const char *eaton_input_eco_mode_auto_off_fun(double value)
12131215
12141216/* High Efficiency (aka ECO) mode for auto start/stop commands */
12151217static 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 },
1218+ { 0 , "normal" , eaton_input_eco_mode_auto_off_fun , NULL },
1219+ { 1 , "ECO" , eaton_input_eco_mode_auto_on_fun , NULL },
1220+ { 2 , "ESS" , NULL , NULL },
12181221 { 0 , NULL , NULL , NULL }
12191222};
12201223
@@ -2043,6 +2046,10 @@ static hid_info_t mge_hid2nut[] =
20432046 /* ECO(HE), ESS Mode switch, to use when 'input.bypass.switch.on' is on */
20442047 { "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 },
20452048
2049+ /* Needs to be Tested */
2050+ /* Command to switch ECO(HE) Mode on/off with switch to Automatic Bypass Mode on/off before */
2051+ { "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 },
2052+
20462053 /* Auto Bypass Mode on/off, to use when 'input.transfer.bypass.forced' is enabled */
20472054 { "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 },
20482055 { "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 +2162,19 @@ static hid_info_t mge_hid2nut[] =
21552162 { "outlet.2.load.on" , 0 , 0 , "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup" , NULL , "0" , HU_TYPE_CMD , NULL },
21562163
21572164 /* 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 */
2165+ { "experimental.ecomode.disable" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "0" , HU_TYPE_CMD , NULL },
2166+ { "experimental.ecomode.enable" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "1" , HU_TYPE_CMD , NULL },
2167+ { "experimental.essmode.enable" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "2" , HU_TYPE_CMD , NULL },
2168+ { "experimental.essmode.disable" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "0" , HU_TYPE_CMD , NULL },
2169+
2170+ /* Command to switch ECO(HE) Mode with switch to Automatic Bypass Mode on before */
21632171 { "experimental.ecomode.start.auto" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "1" , HU_TYPE_CMD , eaton_input_eco_mode_auto_on_off_info },
21642172 /* Command to switch from ECO(HE) Mode with switch from Automatic Bypass Mode on before */
21652173 { "experimental.ecomode.stop.auto" , 0 , 0 , "UPS.PowerConverter.Input.[5].Switchable" , NULL , "0" , HU_TYPE_CMD , eaton_input_eco_mode_auto_on_off_info },
21662174
21672175 /* 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 },
2176+ { "bypass.start" , 0 , 0 , "UPS.PowerConverter.Input.[2].SwitchOnControl" , NULL , "1" , HU_TYPE_CMD , NULL },
2177+ { "bypass.stop" , 0 , 0 , "UPS.PowerConverter.Input.[2].SwitchOffControl" , NULL , "1" , HU_TYPE_CMD , NULL },
21702178
21712179 /* end of structure. */
21722180 { NULL , 0 , 0 , NULL , NULL , NULL , 0 , NULL }
0 commit comments