pymscada 0.2.3__tar.gz → 0.2.4__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.2.3/src/pymscada.egg-info → pymscada-0.2.4}/PKG-INFO +1 -1
- {pymscada-0.2.3 → pymscada-0.2.4}/pyproject.toml +1 -1
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/alarms.py +66 -22
- {pymscada-0.2.3 → pymscada-0.2.4/src/pymscada.egg-info}/PKG-INFO +1 -1
- {pymscada-0.2.3 → pymscada-0.2.4}/LICENSE +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/MANIFEST.in +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/README.md +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/setup.cfg +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/__init__.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/__main__.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/bus_client.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/bus_server.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/callout.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/checkout.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/config.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/console.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/README.md +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/__init__.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/__pycache__/__init__.cpython-311.pyc +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/accuweather.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/alarms.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/bus.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/callout.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/files.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/history.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/logixclient.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/modbus_plc.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/modbusclient.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/modbusserver.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/openweather.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/opnotes.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/piapi.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/ping.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-alarms.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-bus.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-callout.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-demo-modbus_plc.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-files.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-history.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-logixclient.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-modbusclient.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-modbusserver.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-openweather.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-piapi.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-ping.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-sms.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-snmpclient.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-io-witsapi.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-opnotes.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/pymscada-wwwserver.service +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/sms.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/snmpclient.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/tags.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/witsapi.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/demo/wwwserver.yaml +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/files.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/history.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/__init__.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/accuweather.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/logix_client.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/logix_map.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/modbus_client.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/modbus_map.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/modbus_server.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/openweather.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/piapi.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/ping_client.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/ping_map.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/sms.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/snmp_client.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/snmp_map.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/witsapi.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/iodrivers/witsapi_POC.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/main.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/misc.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/module_config.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/opnotes.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/pdf/__init__.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/pdf/__pycache__/__init__.cpython-311.pyc +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/pdf/one.pdf +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/pdf/two.pdf +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/periodic.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/protocol_constants.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/samplers.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/tag.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/tools/get_history.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/tools/snmp_client2.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/tools/walk.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada/www_server.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada.egg-info/SOURCES.txt +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada.egg-info/dependency_links.txt +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada.egg-info/entry_points.txt +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada.egg-info/requires.txt +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/src/pymscada.egg-info/top_level.txt +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_alarms.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_bus_server.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_callout.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_config.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_history.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_misc.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_opnotes.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_periodic.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_samplers.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_sms.py +0 -0
- {pymscada-0.2.3 → pymscada-0.2.4}/tests/test_tag.py +0 -0
|
@@ -241,6 +241,17 @@ class Alarms:
|
|
|
241
241
|
self.connection = sqlite3.connect(db)
|
|
242
242
|
self.table = table
|
|
243
243
|
self.cursor = self.connection.cursor()
|
|
244
|
+
|
|
245
|
+
# Check SQLite version for RETURNING clause support (requires >= 3.35.0)
|
|
246
|
+
sqlite_version = sqlite3.sqlite_version_info
|
|
247
|
+
self.has_returning = sqlite_version >= (3, 35, 0)
|
|
248
|
+
if not self.has_returning:
|
|
249
|
+
logging.warning(
|
|
250
|
+
f'SQLite version {sqlite3.sqlite_version} is older than 3.35.0. '
|
|
251
|
+
f'RETURNING clause not supported, using fallback method. '
|
|
252
|
+
f'Consider upgrading SQLite for better performance.'
|
|
253
|
+
)
|
|
254
|
+
|
|
244
255
|
query = (
|
|
245
256
|
'CREATE TABLE IF NOT EXISTS ' + self.table + ' '
|
|
246
257
|
'(id INTEGER PRIMARY KEY ASC, '
|
|
@@ -277,13 +288,25 @@ class Alarms:
|
|
|
277
288
|
try:
|
|
278
289
|
logging.info(f'add {request}')
|
|
279
290
|
with self.connection:
|
|
280
|
-
self.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
291
|
+
if self.has_returning:
|
|
292
|
+
self.cursor.execute(
|
|
293
|
+
f'INSERT INTO {self.table} '
|
|
294
|
+
'(date_ms, alarm_string, kind, desc, "group") '
|
|
295
|
+
'VALUES(:date_ms, :alarm_string, :kind, :desc, :group) '
|
|
296
|
+
'RETURNING *;',
|
|
297
|
+
request)
|
|
298
|
+
res = self.cursor.fetchone()
|
|
299
|
+
else:
|
|
300
|
+
self.cursor.execute(
|
|
301
|
+
f'INSERT INTO {self.table} '
|
|
302
|
+
'(date_ms, alarm_string, kind, desc, "group") '
|
|
303
|
+
'VALUES(:date_ms, :alarm_string, :kind, :desc, :group);',
|
|
304
|
+
request)
|
|
305
|
+
row_id = self.cursor.lastrowid
|
|
306
|
+
self.cursor.execute(
|
|
307
|
+
f'SELECT * FROM {self.table} WHERE id = ?;',
|
|
308
|
+
(row_id,))
|
|
309
|
+
res = self.cursor.fetchone()
|
|
287
310
|
self.rta.value = {
|
|
288
311
|
'__rta_id__': 0,
|
|
289
312
|
'id': res[0],
|
|
@@ -299,21 +322,42 @@ class Alarms:
|
|
|
299
322
|
try:
|
|
300
323
|
logging.info(f'update {request}')
|
|
301
324
|
with self.connection:
|
|
302
|
-
self.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
325
|
+
if self.has_returning:
|
|
326
|
+
self.cursor.execute(
|
|
327
|
+
f'UPDATE {self.table} SET in_alm = :in_alm '
|
|
328
|
+
'WHERE id = :id RETURNING *;',
|
|
329
|
+
request)
|
|
330
|
+
res = self.cursor.fetchone()
|
|
331
|
+
if res:
|
|
332
|
+
self.rta.value = {
|
|
333
|
+
'__rta_id__': 0,
|
|
334
|
+
'id': res[0],
|
|
335
|
+
'date_ms': res[1],
|
|
336
|
+
'alarm_string': res[2],
|
|
337
|
+
'kind': res[3],
|
|
338
|
+
'desc': res[4],
|
|
339
|
+
'group': res[5]
|
|
340
|
+
}
|
|
341
|
+
else:
|
|
342
|
+
self.cursor.execute(
|
|
343
|
+
f'UPDATE {self.table} SET in_alm = :in_alm '
|
|
344
|
+
'WHERE id = :id;',
|
|
345
|
+
request)
|
|
346
|
+
if self.cursor.rowcount > 0:
|
|
347
|
+
self.cursor.execute(
|
|
348
|
+
f'SELECT * FROM {self.table} WHERE id = :id;',
|
|
349
|
+
request)
|
|
350
|
+
res = self.cursor.fetchone()
|
|
351
|
+
if res:
|
|
352
|
+
self.rta.value = {
|
|
353
|
+
'__rta_id__': 0,
|
|
354
|
+
'id': res[0],
|
|
355
|
+
'date_ms': res[1],
|
|
356
|
+
'alarm_string': res[2],
|
|
357
|
+
'kind': res[3],
|
|
358
|
+
'desc': res[4],
|
|
359
|
+
'group': res[5]
|
|
360
|
+
}
|
|
317
361
|
except sqlite3.IntegrityError as error:
|
|
318
362
|
logging.warning(f'Alarms rta_cb update {error}')
|
|
319
363
|
elif request['action'] == 'HISTORY':
|
|
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
|
|
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
|