pymscada 0.1.11b4__tar.gz → 0.1.11b5__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.
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/PKG-INFO +1 -1
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/pyproject.toml +1 -1
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-ping.service +3 -3
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/tags.yaml +2 -2
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/wwwserver.yaml +1 -1
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/module_config.py +19 -4
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/www_server.py +20 -8
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/LICENSE +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/README.md +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/__init__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/__main__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/bus_client.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/bus_server.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/checkout.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/config.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/console.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/README.md +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/__init__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/accuweather.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/bus.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/files.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/history.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/logixclient.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/modbus_plc.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/modbusclient.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/modbusserver.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/openweather.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/opnotes.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/ping.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-bus.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-demo-modbus_plc.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-files.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-history.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-accuweather.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-logixclient.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-modbusclient.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-modbusserver.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-io-snmpclient.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-opnotes.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/pymscada-wwwserver.service +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/demo/snmpclient.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/files.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/history.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/__init__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/accuweather.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/logix_client.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/logix_map.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/modbus_client.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/modbus_map.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/modbus_server.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/openweather.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/ping_client.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/ping_map.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/snmp_client.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/iodrivers/snmp_map.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/main.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/misc.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/opnotes.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/pdf/__init__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/pdf/one.pdf +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/pdf/two.pdf +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/periodic.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/protocol_constants.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/samplers.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/tag.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/tools/snmp_client2.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/tools/walk.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/src/pymscada/validate.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/__init__.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/bus_echo.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/iodrivers/test_logix.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/iodrivers/test_modbus.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/busserver.yaml +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/db.sqlite +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/hist_tag_0_0.dat +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/hist_tag_0_10_2.dat +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/hist_tag_0_15.dat +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/hist_tag_0_26.dat +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_assets/hist_tag_0_50.dat +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_bus_server.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_config.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_history.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_misc.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_openweather.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_opnotes.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_periodic.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_samplers.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_tag.py +0 -0
- {pymscada-0.1.11b4 → pymscada-0.1.11b5}/tests/test_validate.py +0 -0
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
[Service]
|
|
7
7
|
WorkingDirectory=__DIR__
|
|
8
|
-
ExecStart=__PYMSCADA__
|
|
8
|
+
ExecStart=__PYMSCADA__ pingclient --config __DIR__/config/ping.yaml
|
|
9
9
|
Restart=always
|
|
10
10
|
RestartSec=5
|
|
11
|
-
User=
|
|
12
|
-
Group=
|
|
11
|
+
User=root
|
|
12
|
+
Group=root
|
|
13
13
|
|
|
14
14
|
[Install]
|
|
15
15
|
WantedBy=multi-user.target
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Module configuration and factory system."""
|
|
2
2
|
from typing import Any, Optional, Type
|
|
3
3
|
import argparse
|
|
4
|
+
from textwrap import dedent
|
|
4
5
|
from importlib.metadata import version
|
|
5
6
|
import logging
|
|
6
7
|
from pymscada.config import Config
|
|
@@ -77,8 +78,13 @@ def create_module_registry():
|
|
|
77
78
|
module_class='pymscada.checkout:checkout',
|
|
78
79
|
config=False,
|
|
79
80
|
tags=False,
|
|
80
|
-
epilog="""
|
|
81
|
-
|
|
81
|
+
epilog=dedent("""
|
|
82
|
+
To add to systemd:
|
|
83
|
+
su -
|
|
84
|
+
cd /lib/systemd/system
|
|
85
|
+
cp config/pymscada-bus.service .
|
|
86
|
+
systemctl enable pymscada-bus
|
|
87
|
+
systemctl start pymscada-bus"""),
|
|
82
88
|
extra_args=[
|
|
83
89
|
ModuleArgument(
|
|
84
90
|
('--overwrite',),
|
|
@@ -120,7 +126,12 @@ def create_module_registry():
|
|
|
120
126
|
name='openweatherclient',
|
|
121
127
|
help='poll OpenWeather current and forecast data',
|
|
122
128
|
module_class='pymscada.iodrivers.openweather:OpenWeatherClient',
|
|
123
|
-
tags=False
|
|
129
|
+
tags=False,
|
|
130
|
+
epilog=dedent("""
|
|
131
|
+
OPENWEATHERMAP_API_KEY can be set in the openweathermap.yaml
|
|
132
|
+
or as an environment variable:
|
|
133
|
+
vi ~/.bashrc
|
|
134
|
+
export OPENWEATHERMAP_API_KEY='1234567890'""")
|
|
124
135
|
),
|
|
125
136
|
ModuleDefinition(
|
|
126
137
|
name='pingclient',
|
|
@@ -140,6 +151,9 @@ def create_module_registry():
|
|
|
140
151
|
module_class='pymscada.console:Console',
|
|
141
152
|
config=False,
|
|
142
153
|
await_future=False,
|
|
154
|
+
epilog=dedent("""
|
|
155
|
+
--tags tag.yaml is not strictly necessary, unless you'd
|
|
156
|
+
like to see correctly typed values and set values."""),
|
|
143
157
|
extra_args=[
|
|
144
158
|
ModuleArgument(
|
|
145
159
|
('-p', '--port'),
|
|
@@ -167,7 +181,8 @@ class ModuleFactory:
|
|
|
167
181
|
parser = subparser.add_parser(
|
|
168
182
|
module_def.name,
|
|
169
183
|
help=module_def.help,
|
|
170
|
-
epilog=module_def.epilog
|
|
184
|
+
epilog=module_def.epilog,
|
|
185
|
+
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
171
186
|
)
|
|
172
187
|
if module_def.config:
|
|
173
188
|
parser.add_argument(
|
|
@@ -56,15 +56,27 @@ class WSHandler():
|
|
|
56
56
|
try:
|
|
57
57
|
while True:
|
|
58
58
|
as_bytes, message = await self.queue.get()
|
|
59
|
-
if
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
if self.ws.closed:
|
|
60
|
+
logging.debug(f'{self.rta_id}: WebSocket closed, stopping send_queue')
|
|
61
|
+
break
|
|
62
|
+
try:
|
|
63
|
+
if as_bytes:
|
|
64
|
+
await self.ws.send_bytes(message)
|
|
65
|
+
else:
|
|
66
|
+
await self.ws.send_json(message)
|
|
67
|
+
except ConnectionResetError:
|
|
68
|
+
logging.debug(f'{self.rta_id}: Connection reset, stopping send_queue')
|
|
69
|
+
break
|
|
70
|
+
except Exception as e:
|
|
71
|
+
logging.warning(f'{self.rta_id}: Error sending message: {e}')
|
|
72
|
+
break
|
|
65
73
|
except asyncio.CancelledError:
|
|
66
|
-
logging.
|
|
67
|
-
|
|
74
|
+
logging.debug(f'{self.rta_id}: Send queue cancelled')
|
|
75
|
+
finally:
|
|
76
|
+
# Clean up subscriptions when the connection ends
|
|
77
|
+
for tag in self.tag_by_id.values():
|
|
78
|
+
tag.del_callback_id(self.notify_id)
|
|
79
|
+
tag.del_callback(self.publish)
|
|
68
80
|
|
|
69
81
|
def publish(self, tag: Tag):
|
|
70
82
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|