Giter Site home page Giter Site logo

avocentpdu's Introduction

avocentpdu

A python module that allows switching outlets on/off on an Avocent PDU (PM3012V, PM3009H, may work with others)

Installation

With Pip:

pip install avocentpdu

Manually:

Just drop the pdu.py file into the same folder as the python file you’re calling it from.

Usage

It’s super easy. First, include the module like so

import pdu

then initialise an instance of the PDU class

import pdu
pdu = pdu.PDU("pdu_username", "pdu_password", "JabelonePDU", "https://192.168.0.1")

and finally make a function call to switch_outlet()

import pdu
with pdu.PDU("pdu_username", "pdu_password", "JabelonePDU", "https://192.168.0.1") as pdu:
    pdu.switch_outlet(1, 1)

Reference

PDU(string [username], string [password], string [protocol:ip])

When you create a new instance you should supply it with the username, password and protocol/IP address of the webserver running on the PDU box.

Example:

pdu = pdu.PDU("jabelone", "1234", "JabelonePDU", "https://192.168.0.99")

switch_outlet(string [outlet_number], boolean [state])

When you toggle an outlet you must specify the outlet number (as written on the PDU) and a state. The state should be either True for on or False for off. It will send the http requests out even if it’s already in the requested state so don’t spam it. Or do. ¯\_(ツ)_/¯

Example:

# Turn outlet 1 off
pdu.switch_outlet(1, 0)
# Turn outlet 13 on
pdu.switch_outlet(13, 1)

avocentpdu's People

Contributors

jabelone avatar mkonitzer avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.