From af5a3bf94e95b16b27e250dcd1384bec1c51f7f1 Mon Sep 17 00:00:00 2001 From: Chris Fiege Date: Wed, 30 Oct 2024 11:51:49 +0100 Subject: [PATCH] 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 --- doc/configuration.rst | 2 +- labgrid/driver/power/gude8031.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index f70bf2b66..f6ebec307 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -182,7 +182,7 @@ Currently available are: Controls *Gude Expert Power Control 8008 PDUs* via a simple HTTP API. ``gude8031`` - Controls *Gude Expert Power Control 8031 PDUs* via a simple HTTP API. + Controls *Gude Expert Power Control 8031 PDUs* and *Gude Expert Power Control 87-1210-18 PDUs* via a simple HTTP API. ``gude8225`` Controls *Gude Expert Power Control 8225 PDUs* via a simple HTTP API. diff --git a/labgrid/driver/power/gude8031.py b/labgrid/driver/power/gude8031.py index 91cbc0dc9..24ae1f7f3 100644 --- a/labgrid/driver/power/gude8031.py +++ b/labgrid/driver/power/gude8031.py @@ -1,7 +1,10 @@ import requests # Driver has been tested with: -# Gude Expert Power Control 8031() +# * Gude Expert Power Control 8031() +# * Gude Expert Power Control 87-1210-18 +# This device needs to be used in 'Basic Compatible' mode for HTTP GET +# to be usable. Do not turn on session authentication. # HTTP-GET API is defined in the Gude EPC-HTTP-Interface specification: # http://wiki.gude.info/EPC_HTTP_Interface @@ -9,7 +12,7 @@ # The `components=` parameter defines which status information are # included into the returned JSON. # * `components=0` happily returns an empty response but still switches the -# outputs as requestd. +# outputs as requested. # * `components=1` only includes the output's state into the JSON. PORT = 80 @@ -17,7 +20,7 @@ def power_set(host, port, index, value): index = int(index) - assert 1 <= index <= 8 + assert 1 <= index <= 20 # access the web interface... value = 1 if value else 0 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): def power_get(host, port, index): index = int(index) - assert 1 <= index <= 8 + assert 1 <= index <= 20 # get the component status r = requests.get(f"http://{host}:{port}/status.json?components=1")