Skip to content

Commit 1ba251f

Browse files
committed
NetworkPowerPort: make index optional (default 0)
Smart plugs and similar single-port network-controlled devices shouldn't require the exporter config to include the 'index' argument. Make it optional by including a default of 0 in NetworkPowerPort. Signed-off-by: Trevor Gamblin <[email protected]>
1 parent 2a90e4d commit 1ba251f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

labgrid/resource/power.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class NetworkPowerPort(Resource):
1212
Args:
1313
model (str): model of the external power switch
1414
host (str): host to connect to
15-
index (str): index of the power port on the external switch
15+
index (str): optional, index of the power port on the external switch
1616
"""
1717
model = attr.ib(validator=attr.validators.instance_of(str))
1818
host = attr.ib(validator=attr.validators.instance_of(str))
19-
index = attr.ib(validator=attr.validators.instance_of(str),
19+
index = attr.ib(default=0, validator=attr.validators.instance_of(str),
2020
converter=lambda x: str(int(x)))
2121

2222

0 commit comments

Comments
 (0)