Skip to content

Commit af5a3bf

Browse files
committed
driver/power/gude8031: Add Support for Gude 87-1210-18
The Gude Expert Power Control 87-1210-18 is a vertical 20 port power distribution unit: https://gude-systems.com/en/products/expert-power-control-87-1210/ It uses the same HTTP-API, as the Gude Power Control 8031 - but simply has more ports. This commit adds support and documentation for this device. Loosing the restrictions on the `index` makes it possible to re-use this driver. Setting a non-existent port fails silently. But getting a non-existent port will cause an exception. I deem this behavior acceptable, since a new device will be tested during hardware setup anyway. So we do not need to check the actual number of ports during normal operation. Signed-off-by: Chris Fiege <[email protected]>
1 parent df66ce8 commit af5a3bf

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

doc/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Currently available are:
182182
Controls *Gude Expert Power Control 8008 PDUs* via a simple HTTP API.
183183

184184
``gude8031``
185-
Controls *Gude Expert Power Control 8031 PDUs* via a simple HTTP API.
185+
Controls *Gude Expert Power Control 8031 PDUs* and *Gude Expert Power Control 87-1210-18 PDUs* via a simple HTTP API.
186186

187187
``gude8225``
188188
Controls *Gude Expert Power Control 8225 PDUs* via a simple HTTP API.

labgrid/driver/power/gude8031.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import requests
22

33
# Driver has been tested with:
4-
# Gude Expert Power Control 8031()
4+
# * Gude Expert Power Control 8031()
5+
# * Gude Expert Power Control 87-1210-18
6+
# This device needs to be used in 'Basic Compatible' mode for HTTP GET
7+
# to be usable. Do not turn on session authentication.
58

69
# HTTP-GET API is defined in the Gude EPC-HTTP-Interface specification:
710
# http://wiki.gude.info/EPC_HTTP_Interface
811
#
912
# The `components=<N>` parameter defines which status information are
1013
# included into the returned JSON.
1114
# * `components=0` happily returns an empty response but still switches the
12-
# outputs as requestd.
15+
# outputs as requested.
1316
# * `components=1` only includes the output's state into the JSON.
1417

1518
PORT = 80
1619

1720

1821
def power_set(host, port, index, value):
1922
index = int(index)
20-
assert 1 <= index <= 8
23+
assert 1 <= index <= 20
2124
# access the web interface...
2225
value = 1 if value else 0
2326
r = requests.get(f"http://{host}:{port}/status.json?components=0&cmd=1&p={index}&s={value}")
@@ -26,7 +29,7 @@ def power_set(host, port, index, value):
2629

2730
def power_get(host, port, index):
2831
index = int(index)
29-
assert 1 <= index <= 8
32+
assert 1 <= index <= 20
3033

3134
# get the component status
3235
r = requests.get(f"http://{host}:{port}/status.json?components=1")

0 commit comments

Comments
 (0)