# # $Id: apcnew.dev 866 2008-05-21 20:42:37Z garlick $ # # APC MasterSwitch Plus # # Firmware rev may not be the best indicator of whether you need "apc" # or "apcnew" scripts. We have two data points for "apcnew": # # - Firmware: APP v2.2.0 / AOS v3.0.3 # - Firmware: APP v2.0.2 / AOS v2.5.3 # specification "apcnew" { timeout 10 plug name { "1" "2" "3" "4" "5" "6" "7" "8" } script login { expect "\n" expect "User Name : " send "apc\r\n" expect "Password : " send "apc\r\n" expect "> " send "1\r\n" # device manager menu expect "> " } script logout { send "\033\r\n" } script status_all { send "\r\n" # refresh foreachplug { expect "([0-9]+)-[^\n]*(ON|OFF)[^\n]*\r\n" setplugstate $1 $2 on="ON" off="OFF" } expect "> " } script on { send "%s\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "1\r\n" # immediate on expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } script on_all { send "9\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "1\r\n" # immediate on expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } script off { send "%s\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "2\r\n" # immediate off expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } script off_all { send "9\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "2\r\n" # immediate off expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } # If outlet is initially off, "immediate reboot" (4) will leave it off. # This doesn't match PowerMan's semantics for cycle, therefore do explicit # immediate off + immediate on. script cycle { send "%s\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "2\r\n" # immediate off expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " delay 4 send "1\r\n" # immediate on expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } script cycle_all { send "9\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "8\r\n" # cancel any pending delays expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "2\r\n" # immediate off expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " delay 4 send "1\r\n" # immediate on expect "Enter 'YES' to continue or <ENTER> to cancel : " send "YES\r\n" expect "Command successfully issued.\r\n" send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "> " } }