pymscada 0.2.6b1__py3-none-any.whl → 0.2.6b3__py3-none-any.whl

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/bus_client.py CHANGED
@@ -79,7 +79,8 @@ class BusClient:
79
79
  data = struct.pack(f'>B{size}s', pc.TYPE.JSON, jsonstr)
80
80
  action = request.get("action", "unknown")
81
81
  tag_id = self.tag_by_name[tagname].id
82
- logging.info(f'{self.module}: RTA sending {tagname} {action} to tag_id {tag_id}')
82
+ logging.info(f'{self.module}: RTA sending {tagname} {action} to'
83
+ f' tag_id {tag_id}')
83
84
  self.write(pc.COMMAND.RTA, self.tag_by_name[tagname].id, time_us, data)
84
85
 
85
86
  def write(self, command: pc.COMMAND, tag_id: int, time_us: int,
@@ -87,6 +88,12 @@ class BusClient:
87
88
  """Write a message."""
88
89
  if data is None:
89
90
  data = b''
91
+ try:
92
+ size_total = len(data)
93
+ except Exception:
94
+ size_total = 0
95
+ logging.info(f'{self.module}: write cmd={command} tag_id={tag_id} '
96
+ f'size_total={size_total}')
90
97
  for i in range(0, len(data) + 1, pc.MAX_LEN):
91
98
  snip = data[i:i+pc.MAX_LEN]
92
99
  size = len(snip)
@@ -97,7 +104,9 @@ class BusClient:
97
104
  except (asyncio.IncompleteReadError, ConnectionResetError):
98
105
  self.read_task.cancel()
99
106
  except AttributeError:
100
- logging.warning('Attribute Error, TO DO, fix in test')
107
+ logging.warning(f'{self.module}: write AttributeError '
108
+ f'cmd={command} '
109
+ f'tag_id={tag_id} size={size}')
101
110
 
102
111
  def add_tag(self, tag: Tag):
103
112
  """Add the new tag and get the tag's bus ID."""
pymscada/bus_server.py CHANGED
@@ -111,7 +111,8 @@ class BusConnection():
111
111
  head = await self.reader.readexactly(14)
112
112
  _, cmd, tag_id, size, time_us = unpack('!BBHHQ', head)
113
113
  except (ConnectionResetError, asyncio.IncompleteReadError,
114
- asyncio.CancelledError):
114
+ asyncio.CancelledError) as e:
115
+ logging.warning(f'{self.addr} read error: {e}')
115
116
  break
116
117
  # if the command packet indicates data, get that too
117
118
  if size == 0:
@@ -121,7 +122,8 @@ class BusConnection():
121
122
  payload = await self.reader.readexactly(size)
122
123
  data = unpack(f'!{size}s', payload)[0]
123
124
  except (ConnectionResetError, asyncio.IncompleteReadError,
124
- asyncio.CancelledError):
125
+ asyncio.CancelledError) as e:
126
+ logging.warning(f'{self.addr} read payload error: {e}')
125
127
  break
126
128
  # if MAX_LEN then a continuation packet is required
127
129
  if size == pc.MAX_LEN:
@@ -294,6 +296,8 @@ class BusServer:
294
296
  def read_callback(self, command):
295
297
  """Process read messages, delete broken connections."""
296
298
  bus_id, cmd, tag_id, time_us, data = command
299
+ logging.info(f'recv cmd={cmd} tag_id={tag_id} bus_id={bus_id} '
300
+ f'size={(0 if data is None else len(data))}')
297
301
  if cmd is None:
298
302
  # Clean up tag subscriptions before deleting it
299
303
  for tag in BusTags._tag_by_id.values():
pymscada/opnotes.py CHANGED
@@ -55,7 +55,6 @@ class OpNotes:
55
55
  self.rta = Tag(rta_tag, dict)
56
56
  self.rta.value = {'__rta_id__': 0}
57
57
  self.busclient.add_callback_rta(rta_tag, self.rta_cb)
58
- self.busclient.add_tag(self.rta)
59
58
 
60
59
  def _init_table(self):
61
60
  """Initialize or upgrade the database table schema."""
@@ -105,6 +104,7 @@ class OpNotes:
105
104
  """Respond to Request to Author and publish on rta_tag as needed."""
106
105
  local_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
107
106
  logging.info(f'[{local_time}] RTA callback received: {request}')
107
+ logging.info(f'[{local_time}] DEBUG: rta_tag.id={self.rta.id}, rta_tag.name={self.rta.name}')
108
108
 
109
109
  if 'action' not in request:
110
110
  logging.warning(f'rta_cb malformed {request}')
pymscada/www_server.py CHANGED
@@ -132,6 +132,7 @@ class WSHandler():
132
132
  elif tag.type is bytes:
133
133
  rta_id = unpack_from('>H', tag.value)[0]
134
134
  if rta_id in [0, self.rta_id]:
135
+ logging.info(f'{self.rta_id}: {tag.name} bytes matches id')
135
136
  self.queue.put_nowait((True, pack(
136
137
  f'!HHQ{len(tag.value)}s', # Network big-endian
137
138
  tag.id, # Uint16
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymscada
3
- Version: 0.2.6b1
3
+ Version: 0.2.6b3
4
4
  Summary: Shared tag value SCADA with python backup and Angular UI
5
5
  Author-email: Jamie Walton <jamie@walton.net.nz>
6
6
  License: GPL-3.0-or-later
@@ -1,8 +1,8 @@
1
1
  pymscada/__init__.py,sha256=EyGwdE-vvQmAOFhtiD0XWflRd8pJiByio20eSHr9AXE,978
2
2
  pymscada/__main__.py,sha256=WcyVlrYOoDdktJhOoyubTOycMwpayksFdxwelRU5xpQ,272
3
3
  pymscada/alarms.py,sha256=sWpZ__V0RbcBZV5Zx_WNb6knvAki-HD8pdNxnYoPebM,18252
4
- pymscada/bus_client.py,sha256=gFJA2ACHGKhy01W8yExbL7jjEb9ZzQHyKKw3jCb8wEI,9509
5
- pymscada/bus_server.py,sha256=yP_3s_lIpGNeanFQAAx3dHxLugNe2IIGhuDWjaipv5U,12693
4
+ pymscada/bus_client.py,sha256=BD-6mtSs3L1EUdjkFPZI4w2_iVTSNGlb65qgH3zvQ40,9875
5
+ pymscada/bus_server.py,sha256=ZSJUtfpWxaTqeIfu-nEHr2rVZAY9ITm1BsfItCeST7k,12978
6
6
  pymscada/callout.py,sha256=dVhQrg1MycPzVF42RGPVfUNCdCwYOM-e_Xg_BpaqG2w,9889
7
7
  pymscada/checkout.py,sha256=RLuCMTEuUI7pp1hIRAUPbo8xYFta8TjArelx0SD4gOY,3897
8
8
  pymscada/config.py,sha256=yRENJPGDPLNPOn4zSCE576UO0QWx2Q0VDsaLDEehRmU,2539
@@ -12,12 +12,12 @@ pymscada/history.py,sha256=myyldKWSIRLofFY_ybpKpQVbYok0vMwAti-KACV5rk8,11604
12
12
  pymscada/main.py,sha256=d6EnK4-tEcvM5AqMHYhvqlnSh-E_wd0Tuxk-kXYSiDw,1854
13
13
  pymscada/misc.py,sha256=0Cj6OFhQonyhyk9x0BG5MiS-6EPk_w6zvavt8o_Hlf0,622
14
14
  pymscada/module_config.py,sha256=QfLI6aOB1H5Xo6P_qaaLUKdOzXSfNBXtdHo1dFelCkA,9999
15
- pymscada/opnotes.py,sha256=A6W-oOIIrjxK30nGOIgSp4t9b1jYiatxDFfLOypb01c,8667
15
+ pymscada/opnotes.py,sha256=lERFyl00TDDscaHrUikt82A1uy28lKidxgoRm0PaKrg,8728
16
16
  pymscada/periodic.py,sha256=MLlL93VLvFqBBgjO1Us1t0aLHTZ5BFdW0B__G02T1nQ,1235
17
17
  pymscada/protocol_constants.py,sha256=lPJ4JEgFJ_puJjTym83EJIOw3UTUFbuFMwg3ohyUAGY,2414
18
18
  pymscada/samplers.py,sha256=t0IscgsCm5YByioOZ6aOKMO_guDFS_wxnJSiOGKI4Nw,2583
19
19
  pymscada/tag.py,sha256=hTRxogw8BXAi1OJpM1Lhx4KKMqZ53y7D5KcCycO7fRQ,9471
20
- pymscada/www_server.py,sha256=WeLGRhseXVTns5PKlA0w--byatxpEQ4PcE60qMghLuM,13780
20
+ pymscada/www_server.py,sha256=Xglfh_Ny0TkML6oiTg8opFFTrTpjQr-rFX_5a_D_9y0,13856
21
21
  pymscada/demo/README.md,sha256=iNcVbCTkq-d4agLV-979lNRaqf_hbJCn3OFzY-6qfU8,880
22
22
  pymscada/demo/__init__.py,sha256=WsDDgkWnZBJbt2-cJCdc2NvRAv_T4a7WOC1Q0k_l0gI,29
23
23
  pymscada/demo/accuweather.yaml,sha256=Fk4rV0S8jCau0173QCzKW8TdUbc4crYVi0aD8fPLNgU,322
@@ -80,9 +80,9 @@ pymscada/pdf/__pycache__/__init__.cpython-311.pyc,sha256=4KTfXrV9bGDbTIEv-zgIj_L
80
80
  pymscada/tools/get_history.py,sha256=LfUB7i0qne4lE0lk-bWRmK1B0xpex-AfIOh2paxSDCk,5409
81
81
  pymscada/tools/snmp_client2.py,sha256=pdn5dYyEv4q-ubA0zQ8X-3tQDYxGC7f7Xexa7QPaL40,1675
82
82
  pymscada/tools/walk.py,sha256=OgpprUbKLhEWMvJGfU1ckUt_PFEpwZVOD8HucCgzmOc,1625
83
- pymscada-0.2.6b1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
84
- pymscada-0.2.6b1.dist-info/METADATA,sha256=XYlTJRl-I_bOqvpscLKqWIPA9S3uZiyU8YYpap7bkqY,2389
85
- pymscada-0.2.6b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
- pymscada-0.2.6b1.dist-info/entry_points.txt,sha256=2UJBi8jrqujnerrcXcq4F8GHJYVDt26sacXl94t3sd8,56
87
- pymscada-0.2.6b1.dist-info/top_level.txt,sha256=LxIB-zrtgObJg0fgdGZXBkmNKLDYHfaH1Hw2YP2ZMms,9
88
- pymscada-0.2.6b1.dist-info/RECORD,,
83
+ pymscada-0.2.6b3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
84
+ pymscada-0.2.6b3.dist-info/METADATA,sha256=6NOPR1IbVMuYCKczsfPydqinRF3qBrzTnS1aZRX9fuQ,2389
85
+ pymscada-0.2.6b3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
+ pymscada-0.2.6b3.dist-info/entry_points.txt,sha256=2UJBi8jrqujnerrcXcq4F8GHJYVDt26sacXl94t3sd8,56
87
+ pymscada-0.2.6b3.dist-info/top_level.txt,sha256=LxIB-zrtgObJg0fgdGZXBkmNKLDYHfaH1Hw2YP2ZMms,9
88
+ pymscada-0.2.6b3.dist-info/RECORD,,