19,20d18 < < ojw0000 2007Apr5 Oliver Wilcock - modified to control individual load segments (outlet.2.shutdown.return) on Powerware PW5125. 873,874d870 < dstate_addcmd("outlet.1.shutdown.return"); /* ojw0000 */ < dstate_addcmd("outlet.2.shutdown.return"); /* ojw0000 */ 1102c1098 < unsigned char answer[5], cbuf[6]; --- > unsigned char answer[5], cbuf[3]; 1105,1109d1100 < /* ojw0000 outlet power cycle for PW5125 and perhaps others */ < if (!strcasecmp(cmdname, "outlet.1.shutdown.return") < || !strcasecmp(cmdname, "outlet.2.shutdown.return") < ) { < send_write_command(AUTHOR, 4); 1111d1101 < sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ 1113,1153d1102 < cbuf[0] = PW_LOAD_OFF_RESTART; < cbuf[1] = 0x03; /* outlet off in 3 seconds */ < cbuf[2] = 0x00; /* high byte of the 2 byte time argument */ < cbuf[3] = ( '1' == cmdname[7] ? 0x01 : 0x02); /* which outlet load segment? Assumes '1' or '2' at position 8 of the command string. */ < < /* ojw00000 the following copied from command "shutdown.return" below 2007Apr5 */ < res = command_write_sequence(cbuf, 4, answer); < if (res <= 0) { < upslogx(LOG_ERR, "Short read from UPS"); < dstate_datastale(); < return -1; < } < < sec = (256 * (unsigned char)answer[3]) + (unsigned char)answer[2]; < < switch ((unsigned char) answer[0]) { < < case 0x31: { < upslogx(LOG_NOTICE,"Going down in %d sec", sec); < return STAT_INSTCMD_HANDLED; < break; < } < case 0x33: { < upslogx(LOG_NOTICE, "[%s] disbled by front panel", cmdname); < return STAT_INSTCMD_UNKNOWN; < break; < } < case 0x36: { < upslogx(LOG_NOTICE, "[%s] Invalid parameter", cmdname); < return STAT_INSTCMD_UNKNOWN; < break; < } < default: { < upslogx(LOG_NOTICE, "[%s] not supported", cmdname); < return STAT_INSTCMD_UNKNOWN; < break; < } < } < < } /* ojw0000 end outlet power cycle */ <