Skip to content

AC relay control

This page describes how to toggle the 8 x AC power outlets on the ASS enclosure.

Hardware set up

The intelligent AC power distribution unit (PDU) is a CyberPower Switched, Metered-by-Outlet PDU that Heather calls the Cyberpunk. The model number is Switched Metered-by-Outlet. It's rated for 16 A total (no restrictions to individual ports) and has 8 independently switchable outlets.

Because the output cables are only rated for 10A max, and we don't want to be using that much per port anyway, individual external 8A breakers have been fitted for each outlet. These are button resettable breakers (Phoenix Contact UT 6-TMC M 8A series).

Port number Device
1 xx
2 xx
3 xx
4 xx
5 xx
6 xx
7 xx
8 xx

Software packages

The Cyberpunk runs it's own software internally. You can access it via http on the windows vm, or via telnet on the linux vm. Automated control is achieved using the "Expect" program. "Expect" version 5.45.4 is installed on the linux vm.

Software control

There are two scripts in ~/scripts/pdu:

ass-pdu.sh:

Function:

Calls the expect script below using bash, to give us the option to parse the output nicely.

Usage:

Arguments are 'command' and 'port'. Command can be 'on' 'off' or 'status'. Port is the outlet number from 1-8

Examples:

Return the full device and individual outlet status whether or not you specify a port ass-pdu.sh "status"

Turn on outlet number 5: ass-pdu "on" 5

To / issues:

  • Parse and capture output nicely so that we can log it.

ass_pdu_run_commands.expect

Function:

Direct communication with the PDU via shell interaction

Usage:

Optional arguments are 'command' and 'port'. Command can be 'on' 'off' or 'status'. Port is the outlet number from 1-8

Examples

Return the full device and individual outlet status whether or not you specify a port ass_pdu_run_commands.expect "status"

Turn outlet number 5 on ass_pdu_run_commands.expect "on" 5

To / issues:

  • Set an ntp time server
  • Could use cyberpunk to schedule power cycling if we so wish.
  • this script sometimes fails from too many retrie atttempts logging in. Need to capture outport so we know whether it's been successful or not.