pymscada 0.1.0a1__tar.gz → 0.1.0a4__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.

Potentially problematic release.


This version of pymscada might be problematic. Click here for more details.

Files changed (81) hide show
  1. pymscada-0.1.0a4/PKG-INFO +88 -0
  2. pymscada-0.1.0a4/README.md +67 -0
  3. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/pyproject.toml +1 -1
  4. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/checkout.py +38 -5
  5. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/modbusserver.yaml +8 -0
  6. pymscada-0.1.0a4/src/pymscada/demo/ping.yaml +12 -0
  7. pymscada-0.1.0a4/src/pymscada/demo/pymscada-io-ping.service +15 -0
  8. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/tags.yaml +10 -1
  9. pymscada-0.1.0a4/src/pymscada/demo/wwwserver.yaml +533 -0
  10. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/modbus_client.py +4 -5
  11. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/modbus_map.py +1 -1
  12. pymscada-0.1.0a4/src/pymscada/iodrivers/ping_client.py +120 -0
  13. pymscada-0.1.0a4/src/pymscada/iodrivers/ping_map.py +43 -0
  14. pymscada-0.1.0a4/src/pymscada/main.py +179 -0
  15. pymscada-0.1.0a1/PKG-INFO +0 -270
  16. pymscada-0.1.0a1/README.md +0 -249
  17. pymscada-0.1.0a1/src/pymscada/demo/wwwserver.yaml +0 -87
  18. pymscada-0.1.0a1/src/pymscada/main.py +0 -147
  19. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/LICENSE +0 -0
  20. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/__init__.py +0 -0
  21. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/__main__.py +0 -0
  22. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/bus_client.py +0 -0
  23. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/bus_server.py +0 -0
  24. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/config.py +0 -0
  25. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/console.py +0 -0
  26. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/README.md +0 -0
  27. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/__init__.py +0 -0
  28. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/bus.yaml +0 -0
  29. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/files.yaml +0 -0
  30. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/history.yaml +0 -0
  31. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/logixclient.yaml +0 -0
  32. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/modbus_plc.py +0 -0
  33. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/modbusclient.yaml +0 -0
  34. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-bus.service +0 -0
  35. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-demo-modbus_plc.service +0 -0
  36. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-files.service +0 -0
  37. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-history.service +0 -0
  38. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-io-logixclient.service +0 -0
  39. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-io-modbusclient.service +0 -0
  40. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-io-modbusserver.service +0 -0
  41. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-io-snmpclient.service +0 -0
  42. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/pymscada-wwwserver.service +0 -0
  43. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/demo/snmpclient.yaml +0 -0
  44. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/files.py +0 -0
  45. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/history.py +0 -0
  46. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/__init__.py +0 -0
  47. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/logix_client.py +0 -0
  48. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/logix_map.py +0 -0
  49. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/modbus_server.py +0 -0
  50. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/snmp_client.py +0 -0
  51. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/iodrivers/snmp_map.py +0 -0
  52. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/misc.py +0 -0
  53. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/pdf/__init__.py +0 -0
  54. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/pdf/one.pdf +0 -0
  55. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/pdf/two.pdf +0 -0
  56. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/periodic.py +0 -0
  57. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/protocol_constants.py +0 -0
  58. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/samplers.py +0 -0
  59. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/tag.py +0 -0
  60. {pymscada-0.1.0a1/src/pymscada/iodrivers → pymscada-0.1.0a4/src/pymscada/tools}/snmp_client2.py +0 -0
  61. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/tools/walk.py +0 -0
  62. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/validate.py +0 -0
  63. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/src/pymscada/www_server.py +0 -0
  64. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/__init__.py +0 -0
  65. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/bus_echo.py +0 -0
  66. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/iodrivers/test_logix.py +0 -0
  67. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/iodrivers/test_modbus.py +0 -0
  68. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/busserver.yaml +0 -0
  69. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/hist_tag_0_0.dat +0 -0
  70. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/hist_tag_0_10_2.dat +0 -0
  71. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/hist_tag_0_15.dat +0 -0
  72. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/hist_tag_0_26.dat +0 -0
  73. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_assets/hist_tag_0_50.dat +0 -0
  74. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_bus_server.py +0 -0
  75. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_config.py +0 -0
  76. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_misc.py +0 -0
  77. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_periodic.py +0 -0
  78. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_samplers.py +0 -0
  79. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_tag.py +0 -0
  80. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_tag_history.py +0 -0
  81. {pymscada-0.1.0a1 → pymscada-0.1.0a4}/tests/test_validate.py +0 -0
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.1
2
+ Name: pymscada
3
+ Version: 0.1.0a4
4
+ Summary: Shared tag value SCADA with python backup and Angular UI
5
+ Author-Email: Jamie Walton <jamie@walton.net.nz>
6
+ License: GPL-3.0-or-later
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: JavaScript
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Environment :: Console
12
+ Classifier: Development Status :: 1 - Planning
13
+ Requires-Python: >=3.9
14
+ Requires-Dist: PyYAML>=6.0.1
15
+ Requires-Dist: aiohttp>=3.8.5
16
+ Requires-Dist: pymscada-html<=0.1.0
17
+ Requires-Dist: cerberus>=1.3.5
18
+ Requires-Dist: pycomm3>=1.2.14
19
+ Requires-Dist: pysnmplib>=5.0.24
20
+ Description-Content-Type: text/markdown
21
+
22
+ # pymscada
23
+ #### [Docs](https://github.com/jamie0walton/pymscada/blob/main/docs/README.md)
24
+
25
+ #### [@Github](https://github.com/jamie0walton/pymscada/blob/main/README.md)
26
+
27
+ ## Python Mobile SCADA
28
+
29
+ ```pymscada``` read / write to Modbus and Logix PLCs. Read SNMP OIDs.
30
+ Collect history values and provide the ability to set values and trends
31
+ and issue commands.
32
+
33
+ User interface is via a web client embedded in this package. Examples included
34
+ for securing with Apache as a proxy.
35
+
36
+ Configuration with text yaml files, including the web page which are
37
+ procedurally built.
38
+
39
+ # See also
40
+
41
+ - The angular project [angmscada](https://github.com/jamie0walton/angmscada)
42
+ - Python container for the compiled angular pages [pymscada-html](https://github.com/jamie0walton/pymscada-html)
43
+
44
+ # Licence
45
+
46
+ ```pymscada``` is distributed under the GPLv3 [license](./LICENSE).
47
+
48
+ # Use
49
+ Checkout the example files.
50
+ ```bash
51
+ mscada@raspberrypi:~/test $ pymscada checkout
52
+ making 'history' folder
53
+ making pdf dir
54
+ making config dir
55
+ Creating /home/mscada/test/config/modbusclient.yaml
56
+ Creating /home/mscada/test/config/pymscada-history.service
57
+ Creating /home/mscada/test/config/wwwserver.yaml
58
+ Creating /home/mscada/test/config/pymscada-demo-modbus_plc.service
59
+ Creating /home/mscada/test/config/files.yaml
60
+ Creating /home/mscada/test/config/pymscada-modbusserver.service
61
+ Creating /home/mscada/test/config/pymscada-wwwserver.service
62
+ Creating /home/mscada/test/config/simulate.yaml
63
+ Creating /home/mscada/test/config/tags.yaml
64
+ Creating /home/mscada/test/config/history.yaml
65
+ Creating /home/mscada/test/config/pymscada-files.service
66
+ Creating /home/mscada/test/config/bus.yaml
67
+ Creating /home/mscada/test/config/modbusserver.yaml
68
+ Creating /home/mscada/test/config/modbus_plc.py
69
+ Creating /home/mscada/test/config/pymscada-modbusclient.service
70
+ Creating /home/mscada/test/config/pymscada-bus.service
71
+ Creating /home/mscada/test/config/README.md
72
+ mscada@raspberrypi:~/test $ pymscada validate
73
+ WARNING:root:pymscada 0.1.0 starting
74
+ Config files in ./ valid.
75
+ ```
76
+
77
+ Runs on a Raspberry Pi and includes preconfigured systemd files to
78
+ automate running the services. Mostly works on Windows, works better
79
+ on linux.
80
+
81
+ Modules can be run from the command line, although you need
82
+ a terminal for each running module (better with systemd).
83
+ ```bash
84
+ pymscada bus --config bus.yaml
85
+ pymscada wwwserver --config wwwserver.yaml --tags tags.yaml
86
+ pymscada history --config history.yaml --tags tags.yaml
87
+ python weather.py
88
+ ```
@@ -0,0 +1,67 @@
1
+ # pymscada
2
+ #### [Docs](https://github.com/jamie0walton/pymscada/blob/main/docs/README.md)
3
+
4
+ #### [@Github](https://github.com/jamie0walton/pymscada/blob/main/README.md)
5
+
6
+ ## Python Mobile SCADA
7
+
8
+ ```pymscada``` read / write to Modbus and Logix PLCs. Read SNMP OIDs.
9
+ Collect history values and provide the ability to set values and trends
10
+ and issue commands.
11
+
12
+ User interface is via a web client embedded in this package. Examples included
13
+ for securing with Apache as a proxy.
14
+
15
+ Configuration with text yaml files, including the web page which are
16
+ procedurally built.
17
+
18
+ # See also
19
+
20
+ - The angular project [angmscada](https://github.com/jamie0walton/angmscada)
21
+ - Python container for the compiled angular pages [pymscada-html](https://github.com/jamie0walton/pymscada-html)
22
+
23
+ # Licence
24
+
25
+ ```pymscada``` is distributed under the GPLv3 [license](./LICENSE).
26
+
27
+ # Use
28
+ Checkout the example files.
29
+ ```bash
30
+ mscada@raspberrypi:~/test $ pymscada checkout
31
+ making 'history' folder
32
+ making pdf dir
33
+ making config dir
34
+ Creating /home/mscada/test/config/modbusclient.yaml
35
+ Creating /home/mscada/test/config/pymscada-history.service
36
+ Creating /home/mscada/test/config/wwwserver.yaml
37
+ Creating /home/mscada/test/config/pymscada-demo-modbus_plc.service
38
+ Creating /home/mscada/test/config/files.yaml
39
+ Creating /home/mscada/test/config/pymscada-modbusserver.service
40
+ Creating /home/mscada/test/config/pymscada-wwwserver.service
41
+ Creating /home/mscada/test/config/simulate.yaml
42
+ Creating /home/mscada/test/config/tags.yaml
43
+ Creating /home/mscada/test/config/history.yaml
44
+ Creating /home/mscada/test/config/pymscada-files.service
45
+ Creating /home/mscada/test/config/bus.yaml
46
+ Creating /home/mscada/test/config/modbusserver.yaml
47
+ Creating /home/mscada/test/config/modbus_plc.py
48
+ Creating /home/mscada/test/config/pymscada-modbusclient.service
49
+ Creating /home/mscada/test/config/pymscada-bus.service
50
+ Creating /home/mscada/test/config/README.md
51
+ mscada@raspberrypi:~/test $ pymscada validate
52
+ WARNING:root:pymscada 0.1.0 starting
53
+ Config files in ./ valid.
54
+ ```
55
+
56
+ Runs on a Raspberry Pi and includes preconfigured systemd files to
57
+ automate running the services. Mostly works on Windows, works better
58
+ on linux.
59
+
60
+ Modules can be run from the command line, although you need
61
+ a terminal for each running module (better with systemd).
62
+ ```bash
63
+ pymscada bus --config bus.yaml
64
+ pymscada wwwserver --config wwwserver.yaml --tags tags.yaml
65
+ pymscada history --config history.yaml --tags tags.yaml
66
+ python weather.py
67
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pymscada"
3
- version = "0.1.0a1"
3
+ version = "0.1.0a4"
4
4
  description = "Shared tag value SCADA with python backup and Angular UI"
5
5
  authors = [
6
6
  { name = "Jamie Walton", email = "jamie@walton.net.nz" },
@@ -1,4 +1,5 @@
1
1
  """Create base config folder and check out demo files."""
2
+ import difflib
2
3
  from pathlib import Path
3
4
  import sys
4
5
  from pymscada.config import get_demo_files, get_pdf_files
@@ -36,7 +37,7 @@ def make_pdf():
36
37
  target.write_bytes(pdf_file.read_bytes())
37
38
 
38
39
 
39
- def make_config(overwrite):
40
+ def make_config(overwrite: bool):
40
41
  """Make the config folder, if missing, and copy files in."""
41
42
  config_dir = PATH['__DIR__'].joinpath('config')
42
43
  if not config_dir.exists():
@@ -62,11 +63,43 @@ def make_config(overwrite):
62
63
  target.write_bytes(config_file.read_bytes())
63
64
 
64
65
 
65
- def checkout(overwrite=False):
66
+ def read_with_subst(file: Path):
67
+ """Read the file and replace DIR markers."""
68
+ rd = file.read_bytes().decode()
69
+ if str(file).endswith('service'):
70
+ for k, v in PATH.items():
71
+ rd = rd.replace(k, str(v.absolute()))
72
+ lines = rd.splitlines()
73
+ return lines
74
+
75
+
76
+ def compare_config():
77
+ """Compare old and new config."""
78
+ config_dir = PATH['__DIR__'].joinpath('config')
79
+ if not config_dir.exists():
80
+ print('No config dir, are you in the right directory')
81
+ return
82
+ for config_file in get_demo_files():
83
+ target = config_dir.joinpath(config_file.name)
84
+ if target.exists():
85
+ new_lines = read_with_subst(config_file)
86
+ old_lines = read_with_subst(target)
87
+ diff = list(difflib.unified_diff(old_lines, new_lines,
88
+ fromfile=str(target), tofile=str(config_file)))
89
+ if len(diff):
90
+ print('\n'.join(diff), '\n')
91
+ else:
92
+ print(f'\n--- MISSING FILE\n\n+++ {config_file}')
93
+
94
+
95
+ def checkout(overwrite=False, diff=False):
66
96
  """Do it."""
67
97
  for name in PATH:
68
98
  if not PATH[name].exists():
69
99
  raise SystemExit(f'{PATH[name]} is missing')
70
- make_history()
71
- make_pdf()
72
- make_config(overwrite)
100
+ if diff:
101
+ compare_config()
102
+ else:
103
+ make_history()
104
+ make_pdf(diff)
105
+ make_config(overwrite, diff)
@@ -7,10 +7,18 @@ rtus:
7
7
  tcp_udp: tcp
8
8
  serve:
9
9
  - {unit: 1, file: 4x, start: 1, end: 100}
10
+ - {unit: 2, file: 4x, start: 1, end: 100}
11
+ - {unit: 3, file: 4x, start: 1, end: 100}
10
12
  tags:
11
13
  sim_IntSet:
12
14
  type: int16
13
15
  addr: RTU:1:4x:1
16
+ sim_IntSet2:
17
+ type: int16
18
+ addr: RTU:2:4x:1
19
+ sim_IntSet3:
20
+ type: int16
21
+ addr: RTU:3:4x:1
14
22
  sim_IntVal:
15
23
  type: int16
16
24
  addr: RTU:1:4x:2
@@ -0,0 +1,12 @@
1
+ bus_ip: 127.0.0.1
2
+ bus_port: 1324
3
+ tags:
4
+ localhost_ping:
5
+ type: ping
6
+ addr: '127.0.0.1'
7
+ electronet_ping:
8
+ type: ping
9
+ addr: electronet.co.nz
10
+ google_ping:
11
+ type: ping
12
+ addr: www.google.com
@@ -0,0 +1,15 @@
1
+ [Unit]
2
+ Description=pymscada - Ping client
3
+ BindsTo=pymscada-bus.service
4
+ After=pymscada-bus.service
5
+
6
+ [Service]
7
+ WorkingDirectory=__DIR__
8
+ ExecStart=__PYMSCADA__ ping --config __DIR__/config/ping.yaml
9
+ Restart=always
10
+ RestartSec=5
11
+ User=mscada
12
+ Group=mscada
13
+
14
+ [Install]
15
+ WantedBy=multi-user.target
@@ -253,4 +253,13 @@ Router_eth8_bytes_in:
253
253
  type: int
254
254
  Router_eth8_bytes_out:
255
255
  desc: eth8 bytes out
256
- type: int
256
+ type: int
257
+ localhost_ping:
258
+ desc: Ping time to localhost
259
+ units: ms
260
+ google_ping:
261
+ desc: Ping time to google
262
+ units: ms
263
+ electronet_ping:
264
+ desc: Ping time to electronet
265
+ units: ms