PowerSwitch Device

class ska_mid_cbf_mcs.power_switch.power_switch_device.PowerSwitch(cl, name)[source]

Bases: SKABaseDevice

TANGO device class for controlling and monitoring the web power switch that distributes power to the Talon LRUs.

PowerSwitchModel

TANGO property

PowerSwitchIp

TANGO property

PowerSwitchLogin

TANGO property

PowerSwitchPassword

TANGO property

isCommunicating

Whether or not the power switch can be communicated with

numOutlets

Number of outlets in this power switch

simulationMode

Device attribute.

always_executed_hook() None[source]

Hook to be executed before any attribute access or command.

delete_device() None[source]

Uninitialize the device.

create_component_manager() PowerSwitchComponentManager[source]

Create and return a component manager for this device.

Returns:

a component manager for this device

init_command_objects() None[source]

Sets up the command objects.

write_simulationMode(value: SimulationMode) None[source]

Set the simulation mode of the device. When simulation mode is set to True, the power switch software simulator is used in place of the hardware. When simulation mode is set to False, the real power switch driver is used.

Parameters:

value – SimulationMode

read_numOutlets() int[source]

Get the number of outlets.

Returns:

number of outlets

read_isCommunicating() bool[source]

Get whether or not the power switch is communicating.

Returns:

True if power switch can be contacted, False if not

class InitCommand(target, op_state_model, logger=None)[source]

Bases: InitCommand

A class for the PowerSwitch’s init_device() “command”.

do() Tuple[ResultCode, str][source]

Stateless hook for device initialisation.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

class TurnOnOutletCommand(target, *args, logger=None, **kwargs)[source]

Bases: ResponseCommand

The command class for the TurnOnOutlet command.

Turn on an individual outlet, specified by the outlet ID

do(argin: str) Tuple[ResultCode, str][source]

Implement TurnOnOutlet command functionality.

Parameters:

argin – the outlet ID of the outlet to switch on

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

TurnOnOutlet(argin: str) tango.DevVarLongStringArray[source]

‘TurnOnOutlet’ TANGO command

Parameters:

arg (DevString) – Outlet ID to turn on.

Returns:

Tuple containing a return code and a string message indicating the status of the command.

Return type:

DevVarLongStringArray

class TurnOffOutletCommand(target, *args, logger=None, **kwargs)[source]

Bases: ResponseCommand

The command class for the TurnOffOutlet command.

Turn off an individual outlet, specified by the outlet ID.

do(argin: str) Tuple[ResultCode, str][source]

Implement TurnOffOutlet command functionality.

Parameters:

argin – the outlet ID of the outlet to switch off

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

TurnOffOutlet(argin: str) tango.DevVarLongStringArray[source]

‘TurnOffOutlet’ TANGO command

Parameters:

arg (DevString) – Outlet ID to turn off.

Returns:

Tuple containing a return code and a string message indicating the status of the command.

Return type:

DevVarLongStringArray

class GetOutletPowerModeCommand(target, *args, logger=None, **kwargs)[source]

Bases: BaseCommand

The command class for the GetOutletPowerMode command.

Get the power mode of an individual outlet, specified by the outlet ID.

do(argin: str) PowerMode[source]

Implement GetOutletPowerMode command functionality.

Parameters:

argin – the outlet ID to get the state of

Returns:

power mode of the outlet

GetOutletPowerMode(argin: str) int[source]

‘GetOutletPowerMode’ TANGO command

Parameters:

arg (DevString) – Outlet ID to get the power mode of.

Returns:

Power mode of the outlet.

Return type:

DevULong

DebugDevice()

Enable remote debugging of this device.

To modify behaviour for this command, modify the do() method of the command class: DebugDeviceCommand.

GetVersionInfo()

Return the version information of the device.

To modify behaviour for this command, modify the do() method of the command class.

Returns:

Version details of the device.

GroupDefinitions

Device property.

Each string in the list is a JSON serialised dict defining the group_name, devices and subgroups in the group. A Tango Group object is created for each item in the list, according to the hierarchy defined. This provides easy access to the managed devices in bulk, or individually.

The general format of the list is as follows, with optional devices and subgroups keys:

[ {"group_name": "<name>",
   "devices": ["<dev name>", ...]},
  {"group_name": "<name>",
   "devices": ["<dev name>", "<dev name>", ...],
   "subgroups" : [{<nested group>},
                    {<nested group>}, ...]},
  ...
  ]

For example, a hierarchy of racks, servers and switches:

[ {"group_name": "servers",
   "devices": ["elt/server/1", "elt/server/2",
                 "elt/server/3", "elt/server/4"]},
  {"group_name": "switches",
   "devices": ["elt/switch/A", "elt/switch/B"]},
  {"group_name": "pdus",
   "devices": ["elt/pdu/rackA", "elt/pdu/rackB"]},
  {"group_name": "racks",
   "subgroups": [
        {"group_name": "rackA",
         "devices": ["elt/server/1", "elt/server/2",
                       "elt/switch/A", "elt/pdu/rackA"]},
        {"group_name": "rackB",
         "devices": ["elt/server/3", "elt/server/4",
                       "elt/switch/B", "elt/pdu/rackB"],
         "subgroups": []}
   ]} ]
LoggingLevelDefault

Device property.

Default logging level at device startup. See LoggingLevel

LoggingTargetsDefault

Device property.

Default logging targets at device startup. See the project readme for details.

Off()

Turn the device off.

To modify behaviour for this command, modify the do() method of the command class.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type:

(ResultCode, str)

On()

Turn device on.

To modify behaviour for this command, modify the do() method of the command class.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type:

(ResultCode, str)

Reset()

Reset the device from the FAULT state.

To modify behaviour for this command, modify the do() method of the command class.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type:

(ResultCode, str)

SkaLevel

Device property.

Indication of importance of the device in the SKA hierarchy to support drill-down navigation: 1..6, with 1 highest.

Standby()

Put the device into standby mode.

To modify behaviour for this command, modify the do() method of the command class.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type:

(ResultCode, str)

TangoClassClass

alias of PowerSwitchClass

TangoClassName = 'PowerSwitch'
adminMode

Device attribute.

buildState

Device attribute.

controlMode

Device attribute.

healthState

Device attribute.

loggingLevel

Device attribute.

See LoggingLevel

loggingTargets

Device attribute.

testMode

Device attribute.

versionId

Device attribute.