pymscada 0.1.8__tar.gz → 0.1.10__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.
- {pymscada-0.1.8 → pymscada-0.1.10}/PKG-INFO +1 -1
- {pymscada-0.1.8 → pymscada-0.1.10}/pyproject.toml +1 -1
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/bus_client.py +1 -1
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/accuweather.py +13 -6
- {pymscada-0.1.8 → pymscada-0.1.10}/LICENSE +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/README.md +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/__init__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/__main__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/bus_server.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/checkout.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/config.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/console.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/README.md +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/__init__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/accuweather.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/bus.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/files.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/history.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/logixclient.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/modbus_plc.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/modbusclient.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/modbusserver.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/opnotes.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/ping.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-bus.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-demo-modbus_plc.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-files.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-history.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-accuweather.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-logixclient.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-modbusclient.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-modbusserver.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-ping.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-io-snmpclient.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-opnotes.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/pymscada-wwwserver.service +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/snmpclient.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/tags.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/demo/wwwserver.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/files.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/history.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/__init__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/logix_client.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/logix_map.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/modbus_client.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/modbus_map.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/modbus_server.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/ping_client.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/ping_map.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/snmp_client.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/iodrivers/snmp_map.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/main.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/misc.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/opnotes.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/pdf/__init__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/pdf/one.pdf +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/pdf/two.pdf +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/periodic.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/protocol_constants.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/samplers.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/tag.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/tools/snmp_client2.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/tools/walk.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/validate.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/src/pymscada/www_server.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/__init__.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/bus_echo.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/iodrivers/test_logix.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/iodrivers/test_modbus.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/busserver.yaml +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/db.sqlite +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/hist_tag_0_0.dat +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/hist_tag_0_10_2.dat +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/hist_tag_0_15.dat +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/hist_tag_0_26.dat +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_assets/hist_tag_0_50.dat +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_bus_server.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_config.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_history.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_misc.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_opnotes.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_periodic.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_samplers.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_tag.py +0 -0
- {pymscada-0.1.8 → pymscada-0.1.10}/tests/test_validate.py +0 -0
|
@@ -109,7 +109,7 @@ class BusClient:
|
|
|
109
109
|
self.ip, self.port)
|
|
110
110
|
self.addr = self.writer.get_extra_info('sockname')
|
|
111
111
|
self.write(pc.CMD_LOG, 0, 0, f'{self.module} connected'.encode())
|
|
112
|
-
logging.
|
|
112
|
+
logging.warning(f'connected {self.addr} {self.port}')
|
|
113
113
|
for tag in Tag.get_all_tags().values():
|
|
114
114
|
self.add_tag(tag)
|
|
115
115
|
Tag.set_notify(self.add_tag)
|
|
@@ -29,6 +29,7 @@ class AccuWeatherClient:
|
|
|
29
29
|
for x in api['locations'].values()]
|
|
30
30
|
self.session = aiohttp.ClientSession()
|
|
31
31
|
self.queue = asyncio.Queue()
|
|
32
|
+
self.init_run = True
|
|
32
33
|
|
|
33
34
|
async def handle_response(self):
|
|
34
35
|
"""Unpack the weather values from the json response."""
|
|
@@ -41,7 +42,7 @@ class AccuWeatherClient:
|
|
|
41
42
|
for record in json:
|
|
42
43
|
epoch = record['EpochDateTime']
|
|
43
44
|
hour = int((epoch - time_mod) / 3600)
|
|
44
|
-
logging.
|
|
45
|
+
logging.info(f'epoch {epoch} time_s {time_s} hour {hour}')
|
|
45
46
|
if hour not in self.api['times']:
|
|
46
47
|
continue
|
|
47
48
|
suffix = ''
|
|
@@ -54,26 +55,32 @@ class AccuWeatherClient:
|
|
|
54
55
|
['Rain', 'Rain', None, 'Value'],
|
|
55
56
|
['Snow', 'Snow', None, 'Value']
|
|
56
57
|
]:
|
|
57
|
-
|
|
58
|
+
tagname = f'{site}{parm}{suffix}'
|
|
59
|
+
tag = self.tags[tagname]
|
|
58
60
|
if key2 is None:
|
|
59
61
|
value = record[key1][key]
|
|
60
62
|
else:
|
|
61
63
|
value = record[key1][key2][key]
|
|
64
|
+
logging.info(f'{tagname} was {tag.value} new {value}')
|
|
62
65
|
if tag.value != value:
|
|
63
66
|
tag.value = value, int(epoch * 1e6), self.map_bus
|
|
64
67
|
|
|
65
68
|
async def fetch_data(self, location, url, query):
|
|
66
69
|
"""HTTP get."""
|
|
67
70
|
logging.warning(f'poll {location} {url}')
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
try:
|
|
72
|
+
async with self.session.get(url, params=query,
|
|
73
|
+
proxy=self.proxy) as resp:
|
|
74
|
+
self.queue.put_nowait([location, await resp.json()])
|
|
75
|
+
except asyncio.TimeoutError as e:
|
|
76
|
+
logging.warning('AccuWeather {e}')
|
|
71
77
|
|
|
72
78
|
async def poll(self):
|
|
73
79
|
"""Poll the weather site near the start of each hour."""
|
|
74
80
|
now = int(time())
|
|
75
|
-
if now % 3600 != 120:
|
|
81
|
+
if now % 3600 != 120 and not self.init_run:
|
|
76
82
|
return
|
|
83
|
+
self.init_run = False
|
|
77
84
|
if not self.queue.empty():
|
|
78
85
|
return
|
|
79
86
|
# Get the weather forecasts
|
|
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
|