pyModbusTCP-cli 0.4.0a2__tar.gz → 0.4.0a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pymodbustcp_cli-0.4.0a2 → pymodbustcp_cli-0.4.0a3}/PKG-INFO +19 -7
- {pymodbustcp_cli-0.4.0a2 → pymodbustcp_cli-0.4.0a3}/README.md +17 -5
- {pymodbustcp_cli-0.4.0a2 → pymodbustcp_cli-0.4.0a3}/pyproject.toml +4 -2
- {pymodbustcp_cli-0.4.0a2 → pymodbustcp_cli-0.4.0a3}/.gitignore +0 -0
- {pymodbustcp_cli-0.4.0a2 → pymodbustcp_cli-0.4.0a3}/LICENSE +0 -0
- /pymodbustcp_cli-0.4.0a2/hatch_build.py → /pymodbustcp_cli-0.4.0a3/hatch_metadata_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pyModbusTCP-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.0a3
|
|
4
4
|
Summary: Command line tools for pyModbusTCP: Modbus/TCP server, client and Modbus TCP/RTU gateways
|
|
5
5
|
Project-URL: Source, https://github.com/sourceperl/pyModbusTCP
|
|
6
6
|
Project-URL: Issues, https://github.com/sourceperl/pyModbusTCP/issues
|
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
15
|
Classifier: Topic :: System :: Networking
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
|
-
Requires-Dist: pymodbustcp[serial]==0.4.
|
|
17
|
+
Requires-Dist: pymodbustcp[serial]==0.4.0a3
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
|
|
20
20
|
# pyModbusTCP-cli
|
|
@@ -39,7 +39,7 @@ command in the PATH and installs no dependency.
|
|
|
39
39
|
pipx install pyModbusTCP-cli
|
|
40
40
|
|
|
41
41
|
# or in a virtual environment, with the library
|
|
42
|
-
pip install "pyModbusTCP[cli]==0.4.
|
|
42
|
+
pip install "pyModbusTCP[cli]==0.4.0a3"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
**Alpha**: pyModbusTCP-cli is new with pyModbusTCP 0.4.0, only pre-releases exist for now. The commands, their
|
|
@@ -51,7 +51,7 @@ Without this package, the tools can still be run from the library alone:
|
|
|
51
51
|
```bash
|
|
52
52
|
python -m pyModbusTCP.tools server --help
|
|
53
53
|
python -m pyModbusTCP.tools client --help
|
|
54
|
-
pip install "pyModbusTCP[serial]==0.4.
|
|
54
|
+
pip install "pyModbusTCP[serial]==0.4.0a3" # pyserial, only needed by the gateways
|
|
55
55
|
python -m pyModbusTCP.tools tcp2rtu --help
|
|
56
56
|
python -m pyModbusTCP.tools rtu2tcp --help
|
|
57
57
|
```
|
|
@@ -65,7 +65,11 @@ mbtcp-server --log-changes
|
|
|
65
65
|
# read 4 holding registers from address 0, write some values
|
|
66
66
|
mbtcp-client -p 5020 read-holding 0 -n 4
|
|
67
67
|
mbtcp-client -p 5020 write-registers 0 100 200 0x1234
|
|
68
|
+
mbtcp-client -p 5020 write-read 0 20 22 1 -n 4 # write then read in one request (function 0x17)
|
|
68
69
|
mbtcp-client -p 5020 write-coil 10 on
|
|
70
|
+
# float32 values on 2 registers, word swapped (CDAB): -T/--type and -b/--byte-order
|
|
71
|
+
mbtcp-client -p 5020 write-registers 20 3.14 -2.5 -T float32 -b CDAB
|
|
72
|
+
mbtcp-client -p 5020 read-holding 20 -n 2 -T float32 -b CDAB
|
|
69
73
|
|
|
70
74
|
# TCP clients of the 192.168.1.0/24 network can read (only) the RTU slaves of /dev/ttyUSB0
|
|
71
75
|
mbtcp-tcp2rtu -H 0.0.0.0 -A 192.168.1.0/24 --read-only -b 19200 --parity E /dev/ttyUSB0
|
|
@@ -74,7 +78,11 @@ mbtcp-tcp2rtu -H 0.0.0.0 -A 192.168.1.0/24 --read-only -b 19200 --parity E /dev/
|
|
|
74
78
|
mbtcp-rtu2tcp -a 30 -H 192.168.1.10 /dev/ttyUSB0
|
|
75
79
|
```
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
On a terminal, `mbtcp-client` prints a table (registers in hexadecimal, unsigned, signed, binary and ASCII, bits
|
|
82
|
+
in a grid); with `-i` it is refreshed in place and the changed values are highlighted. For a script, `-f plain`,
|
|
83
|
+
`-f csv` or `-f json` (the default output of a pipe is `plain`: one `address value` line per item).
|
|
84
|
+
|
|
85
|
+
Run any command with `--help` for all its options, `-v/--version` for its version.
|
|
78
86
|
|
|
79
87
|
## Security
|
|
80
88
|
|
|
@@ -84,9 +92,13 @@ The server and the TCP to RTU gateway are designed to be safe by default:
|
|
|
84
92
|
- they listen on `localhost` and on port 5020 by default: use `-H` with the address of the network interface that
|
|
85
93
|
needs it (`0.0.0.0` only if every network of the host is trusted);
|
|
86
94
|
- `-A/--allow` restricts the clients to some IP addresses or networks, `--read-only` refuses every write;
|
|
87
|
-
- the TCP to RTU gateway
|
|
95
|
+
- the TCP to RTU gateway only relays the standard data functions by default (no diagnostics, file records or vendor
|
|
96
|
+
functions): `--functions` sets the list;
|
|
97
|
+
- the TCP to RTU gateway refuses broadcast requests (unit id 0) unless `--allow-broadcast` is set (and then only
|
|
98
|
+
for the write functions, answered at once);
|
|
88
99
|
- `--max-connections-per-host` (default 16) keeps a single client host from taking every connection, and the TCP
|
|
89
|
-
to RTU gateway shares the serial line between the client hosts (at most 2
|
|
100
|
+
to RTU gateway shares the serial line between the client hosts (at most 2 requests per host waiting for the line or
|
|
101
|
+
in progress).
|
|
90
102
|
|
|
91
103
|
Port 502 (the standard Modbus/TCP port) is a privileged port on Unix systems. **Never run these commands as root (or
|
|
92
104
|
with sudo) to listen on it.** Give the `CAP_NET_BIND_SERVICE` capability to the Python interpreter of a virtual
|
|
@@ -20,7 +20,7 @@ command in the PATH and installs no dependency.
|
|
|
20
20
|
pipx install pyModbusTCP-cli
|
|
21
21
|
|
|
22
22
|
# or in a virtual environment, with the library
|
|
23
|
-
pip install "pyModbusTCP[cli]==0.4.
|
|
23
|
+
pip install "pyModbusTCP[cli]==0.4.0a3"
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
**Alpha**: pyModbusTCP-cli is new with pyModbusTCP 0.4.0, only pre-releases exist for now. The commands, their
|
|
@@ -32,7 +32,7 @@ Without this package, the tools can still be run from the library alone:
|
|
|
32
32
|
```bash
|
|
33
33
|
python -m pyModbusTCP.tools server --help
|
|
34
34
|
python -m pyModbusTCP.tools client --help
|
|
35
|
-
pip install "pyModbusTCP[serial]==0.4.
|
|
35
|
+
pip install "pyModbusTCP[serial]==0.4.0a3" # pyserial, only needed by the gateways
|
|
36
36
|
python -m pyModbusTCP.tools tcp2rtu --help
|
|
37
37
|
python -m pyModbusTCP.tools rtu2tcp --help
|
|
38
38
|
```
|
|
@@ -46,7 +46,11 @@ mbtcp-server --log-changes
|
|
|
46
46
|
# read 4 holding registers from address 0, write some values
|
|
47
47
|
mbtcp-client -p 5020 read-holding 0 -n 4
|
|
48
48
|
mbtcp-client -p 5020 write-registers 0 100 200 0x1234
|
|
49
|
+
mbtcp-client -p 5020 write-read 0 20 22 1 -n 4 # write then read in one request (function 0x17)
|
|
49
50
|
mbtcp-client -p 5020 write-coil 10 on
|
|
51
|
+
# float32 values on 2 registers, word swapped (CDAB): -T/--type and -b/--byte-order
|
|
52
|
+
mbtcp-client -p 5020 write-registers 20 3.14 -2.5 -T float32 -b CDAB
|
|
53
|
+
mbtcp-client -p 5020 read-holding 20 -n 2 -T float32 -b CDAB
|
|
50
54
|
|
|
51
55
|
# TCP clients of the 192.168.1.0/24 network can read (only) the RTU slaves of /dev/ttyUSB0
|
|
52
56
|
mbtcp-tcp2rtu -H 0.0.0.0 -A 192.168.1.0/24 --read-only -b 19200 --parity E /dev/ttyUSB0
|
|
@@ -55,7 +59,11 @@ mbtcp-tcp2rtu -H 0.0.0.0 -A 192.168.1.0/24 --read-only -b 19200 --parity E /dev/
|
|
|
55
59
|
mbtcp-rtu2tcp -a 30 -H 192.168.1.10 /dev/ttyUSB0
|
|
56
60
|
```
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
On a terminal, `mbtcp-client` prints a table (registers in hexadecimal, unsigned, signed, binary and ASCII, bits
|
|
63
|
+
in a grid); with `-i` it is refreshed in place and the changed values are highlighted. For a script, `-f plain`,
|
|
64
|
+
`-f csv` or `-f json` (the default output of a pipe is `plain`: one `address value` line per item).
|
|
65
|
+
|
|
66
|
+
Run any command with `--help` for all its options, `-v/--version` for its version.
|
|
59
67
|
|
|
60
68
|
## Security
|
|
61
69
|
|
|
@@ -65,9 +73,13 @@ The server and the TCP to RTU gateway are designed to be safe by default:
|
|
|
65
73
|
- they listen on `localhost` and on port 5020 by default: use `-H` with the address of the network interface that
|
|
66
74
|
needs it (`0.0.0.0` only if every network of the host is trusted);
|
|
67
75
|
- `-A/--allow` restricts the clients to some IP addresses or networks, `--read-only` refuses every write;
|
|
68
|
-
- the TCP to RTU gateway
|
|
76
|
+
- the TCP to RTU gateway only relays the standard data functions by default (no diagnostics, file records or vendor
|
|
77
|
+
functions): `--functions` sets the list;
|
|
78
|
+
- the TCP to RTU gateway refuses broadcast requests (unit id 0) unless `--allow-broadcast` is set (and then only
|
|
79
|
+
for the write functions, answered at once);
|
|
69
80
|
- `--max-connections-per-host` (default 16) keeps a single client host from taking every connection, and the TCP
|
|
70
|
-
to RTU gateway shares the serial line between the client hosts (at most 2
|
|
81
|
+
to RTU gateway shares the serial line between the client hosts (at most 2 requests per host waiting for the line or
|
|
82
|
+
in progress).
|
|
71
83
|
|
|
72
84
|
Port 502 (the standard Modbus/TCP port) is a privileged port on Unix systems. **Never run these commands as root (or
|
|
73
85
|
with sudo) to listen on it.** Give the `CAP_NET_BIND_SERVICE` capability to the Python interpreter of a virtual
|
|
@@ -8,7 +8,8 @@ build-backend = "hatchling.build"
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "pyModbusTCP-cli"
|
|
10
10
|
# version: the one of pyModbusTCP (../pyModbusTCP/constants.py, see [tool.hatch.version]), the two packages are always
|
|
11
|
-
# released together with the same version; dependencies: exactly this release of pyModbusTCP (set by
|
|
11
|
+
# released together with the same version; dependencies: exactly this release of pyModbusTCP (set by
|
|
12
|
+
# hatch_metadata_cli.py)
|
|
12
13
|
dynamic = ["version", "dependencies"]
|
|
13
14
|
description = "Command line tools for pyModbusTCP: Modbus/TCP server, client and Modbus TCP/RTU gateways"
|
|
14
15
|
readme = "README.md"
|
|
@@ -40,7 +41,8 @@ Issues = "https://github.com/sourceperl/pyModbusTCP/issues"
|
|
|
40
41
|
path = "../pyModbusTCP/constants.py"
|
|
41
42
|
|
|
42
43
|
[tool.hatch.metadata.hooks.custom]
|
|
43
|
-
#
|
|
44
|
+
# requirement on exactly this release of pyModbusTCP
|
|
45
|
+
path = "hatch_metadata_cli.py"
|
|
44
46
|
|
|
45
47
|
[tool.hatch.build.targets.wheel]
|
|
46
48
|
# no code in this package (see above): only the metadata and the commands
|
|
File without changes
|
|
File without changes
|
|
File without changes
|