phenome.extensions.lib.dlipower module¶
Digital Loggers Web Power Switch Management The module provides a python class named powerswitch that allows managing the web power switch from python programs. When run as a script this acts as a command line utility to manage the DLI Power switch. .. rubric:: Notes
This module has been tested against the following Digital Loggers Power network power switches:
WebPowerSwitch II WebPowerSwitch III WebPowerSwitch IV WebPowerSwitch V Ethernet Power Controller III
-
class
Outlet(switch, outlet_number, description=None, state=None)¶ Bases:
objectA power outlet class
-
cycle()¶
-
property
name¶ Return the name or description of the outlet
-
off()¶ Turn the outlet off
-
on()¶ Turn the outlet on
-
rename(new_name)¶ Rename the outlet :param new_name: New name for the outlet :return:
-
property
state¶ Return the outlet state
-
use_description= True¶
-
-
class
PowerSwitch(userid=None, password=None, hostname=None, timeout=None, cycletime=None, retries=None)¶ Bases:
objectPowerswitch class to manage the Digital Loggers Web power switch
-
command_on_outlets(command, outlets)¶ If a single outlet is passed, handle it as a single outlet and pass back the return code. Otherwise run the operation on multiple outlets in parallel the return code will be failure if any operation fails. Operations that return a string will return a list of strings.
-
cycle(outlet=0)¶ Cycle power to an outlet True = Power CYCLE Success False = Power off Fail or Power back on Fail
-
determine_outlet(outlet=None)¶ Get the correct outlet number from the outlet passed in, this allows specifying the outlet by the name and making sure the returned outlet is an int
-
get_outlet_name(outlet=0)¶ Return the name of the outlet
-
get_outlets()¶
-
geturl(url='index.htm')¶ Get a URL from the userid/password protected powerswitch page Return None on failure
-
load_configuration()¶ Return a configuration dictionary
-
off(outlet=0)¶ Turn off a power to an outlet NOTE - changed return codes from original version of this file. True == Success False == Fail
-
on(outlet=0)¶ Turn on power to an outlet NOTE - changed return codes from original version of this file. True == Success False == Fail
-
printstatus()¶ Print the status off all the outlets as a table to stdout
-
save_configuration()¶ Update the configuration file with the object’s settings
-
set_outlet_name(outlet=0, name='Unknown')¶ Set the name of an outlet
-
status(outlet=1)¶ Return the status of an outlet, returned value will be one of: ON, OFF, UNKNOWN
-
statuslist()¶ Return the status of all outlets in a list, each item will contain 3 items plugnumber, hostname and state
-
verify()¶ Verify we can reach the switch, returns true if ok
-