Skip to content

Commit 53b3384

Browse files
committed
Updating documentation for new release
--- + Fix some typos in iedctrl.py
1 parent 6c7db13 commit 53b3384

7 files changed

Lines changed: 64 additions & 9 deletions

File tree

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ and MacOS. Any other Python version is not officially supported::
5353
:hidden:
5454

5555
protocols/iec61850/iedmap
56+
protocols/iec61850/iedctrl
5657
protocols/iec61850/api
5758

5859
.. toctree::

docs/source/protocols/iec61850/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ API Reference
88

99
api_data_classes
1010
api_path
11+
api_control
1112
api_client
1213
api_goose
1314
api_sv

docs/source/protocols/iec61850/api_client.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
IED Client
55
==========
66

7-
.. note::
8-
9-
Operation related commands are not implemented yet.
10-
11-
127
.. automodule:: icspacket.proto.iec61850.client
138
:members:
149
:undoc-members:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _iec61850_api_control:
2+
3+
4+
Control / Operation
5+
===================
6+
7+
8+
.. automodule:: icspacket.proto.iec61850.control
9+
:members:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _iec61850_example_iedctrl:
2+
3+
Operating on IEDs
4+
=================
5+
6+
`iedctrl` is a command-line utility to perform control operations on IEC61850 IEDs.
7+
Supports selecting, operating, and optionally querying values after execution.
8+
9+
Usage
10+
-----
11+
12+
.. code-block::
13+
14+
ied_operate.py -t [LDName/]LNName.[FC].DataName --value VALUE [--check] <host>
15+
ied_operate.py -t [LDName/]LNName.[FC].DataName --toggle [--check] <host>
16+
17+
18+
Examples
19+
--------
20+
21+
Operate a control object with a specific value:
22+
23+
.. code-block::
24+
25+
iedctrl.py -t 'simpleIOGenericIO/GGIO1.SPCSO3' --value true --check 127.0.0.1
26+
[I] Associating MMS environment with peer 127.0.0.1:102...
27+
[I] Control model for node: DIRECT_ENHANCED
28+
[I] Value will be changed to: True
29+
[I] Successfully completed operation on SPCSO3!
30+
Current value: TRUE
31+
32+
Toggle a boolean control object:
33+
34+
.. code-block::
35+
36+
iedctrl.py -t 'simpleIOGenericIO/GGIO1.SPCSO4' --toggle --check 127.0.0.1
37+
[I] Associating MMS environment with peer 127.0.0.1:102...
38+
[I] Control model for node: SBO_ENHANCED
39+
[I] Value will be changed from FALSE -> TRUE
40+
[I] Successfully completed operation on SPCSO4!
41+
Current value: TRUE
42+
43+
Notes
44+
-----
45+
46+
- The ``target`` argument supports specifying logical device (LD), logical node (LN), functional constraint (FC), and data name. If the LD is omitted, the default LD will be queried first.
47+
- JSON is used to represent structured values. Files containing JSON can also be passed instead of inline JSON strings.
48+
- The ``--check`` option ensures the tool reads back the value after the control operation to verify success.

docs/source/protocols/iec61850/iedmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Usage
3131

3232
.. code-block:: bash
3333
34-
iedmap [OPTIONS] <host> [-p <port>]
34+
iedmap.py [OPTIONS] <host> [-p <port>]
3535
3636
Where ``<host>`` specifies the IED (IP address or hostname), and ``port``
3737
(default 102) is the MMS communication port.

src/icspacket/examples/iedctrl.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ def cli2data(value: str) -> Any | None:
4545
doc = json.load(fp)
4646
else:
4747
doc = json.loads(value)
48-
if "value" in doc:
49-
doc = doc["value"]
5048
except json.JSONDecodeError as e:
5149
logging.error(f"Invalid JSON value format: {value!r} - {e}")
5250
return None
51+
52+
if isinstance(doc, dict) and "value" in doc:
53+
doc = doc["value"]
5354
return doc
5455

5556

@@ -64,7 +65,7 @@ def cli_main():
6465
group = parser.add_argument_group("Target Options")
6566
group.add_argument("-t", "--target", metavar="[LDName/]LNName.[FC].DataName", default=None, help=(
6667
"Target data node to control. If missing the logical device (LDName), the service will first be \n"
67-
"queried for the default logical node (LNName) and then the data node (DataName) will be used. \n"
68+
"queried for the default logical device and then the data node (DataName) will be used. \n"
6869
"Functional Constrains (FC) is optional as this will always be the CO (Control)."
6970
), required=True)
7071
group.add_argument("--check", action="store_true", help="Queries the value after successful operation.")

0 commit comments

Comments
 (0)