# # Derived from apcpdu.dev, but updated for new firmware # # - Firmware: APP v3.3.3 / AOS v3.3.4 # specification "apcpdu3" { timeout 10 plug name { "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" } script login { expect "\n" expect "\rUser Name : " send "apc\r\n" expect "\rPassword : " send "apc\r\n" expect "> " send "1\r\n" # device manager menu expect "> " send "2\r\n" # outlet management expect "> " send "1\r\n" # Outlet Control/Configuration expect "to continue..." send "\r\n" expect "> " } script logout { send "\033" expect "> " send "\033" expect "> " send "4\r\n" } script status_all { send "\r\n" # refresh send "\r\n" # to continue... (after plug 22) foreachplug { expect "([0-9])*[^\r\n]*(ON|OFF)\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 "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "1\r\n" # immediate on expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" expect "> " } script on_all { send "25\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "4\r\n" # delayed on expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" expect "> " } script off { send "%s\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "2\r\n" # immediate off expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" expect "> " } script off_all { send "25\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "5\r\n" # delayed off expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" 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 "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "2\r\n" # immediate off expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " delay 4 send "1\r\n" # immediate on expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" } script cycle_all { send "25\r\n" expect "> " send "1\r\n" # select outlet control expect "> " send "7\r\n" # cancel any pending delays expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "5\r\n" # delayed off expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " delay 4 send "4\r\n" # delayed on expect "to cancel : " send "YES\r\n" expect "to continue..." send "\r\n" expect "> " send "\033" expect "> " send "\033" expect "to continue..." send "\r\n" expect "> " } }