Skip to content

Commit

Permalink
Merge pull request labgrid-project#1030 from userid0x0/gude8225
Browse files Browse the repository at this point in the history
driver/power: add support for Gude Expert Power Control 8225
  • Loading branch information
Emantor committed Nov 18, 2022
2 parents 6dc2b7b + 2924e18 commit b6fee44
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ Currently available are:
``gude8031``
Controls a Gude Expert Power Control 8031 PDU via a simple HTTP API.

``gude8225``
Controls a Gude Expert Power Control 8225 PDU via a simple HTTP API.

``gude8316``
Controls a Gude Expert Power Control 8316 PDU via a simple HTTP API.

Expand Down
32 changes: 32 additions & 0 deletions labgrid/driver/power/gude8225.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests

# Driver has been tested with:
# Gude Expert Power Control 8225-1 - v1.0.6

# HTTP-GET API is defined in the Gude EPC-HTTP-Interface specification:
# https://wiki.gude.info/EPC_HTTP_Interface

PORT = 80


def power_set(host, port, index, value):
index = int(index)
assert 1 <= index <= 12

value = 1 if value else 0
r = requests.get(
f"https://{host}:{port}/ov.html?cmd=1&p={index}&s={value}"
)
r.raise_for_status()


def power_get(host, port, index):
index = int(index)
assert 1 <= index <= 12

r = requests.get(f"https://{host}:{port}/statusjsn.js?components=1")
r.raise_for_status()

state = r.json()['outputs'][index - 1]['state']

return state

0 comments on commit b6fee44

Please sign in to comment.