Commit a466903ac5e3f7b6c5eedb97981b67195835b71c

Authored by Alain Klotz
2 parents 1d298020 0eaf1aa9
Exists in dev

Merge branch 'dev' of https://gitlab.irap.omp.eu/epallier/pyros into dev

simulators/logconf/logging.ini
... ... @@ -22,7 +22,7 @@ args=('../../logs/guitalens.log', 'a')
22 22  
23 23 [handler_consoleHandler]
24 24 class=StreamHandler
25   -level=INFO
  25 +level=DEBUG
26 26 formatter=simpleFormaters
27 27 args=(sys.stdout,)
28 28  
... ...
simulators/plc/colibri-new-fixed-2.json
... ... @@ -137,7 +137,7 @@
137 137 "entities": [
138 138 {
139 139 "entity_name": "PLC_STATUS",
140   - "from": "Beckhoff",
  140 + "origin": "Beckhoff",
141 141 "version_firmware": "20170809",
142 142 "site": "OSM-Mexico",
143 143 "date": "2017-03-03T13:45:00",
... ...
simulators/plc/guitalens_worker.py
... ... @@ -90,7 +90,7 @@ class WorkerUrl(threading.Thread):
90 90 def set_values(self, ret):
91 91 # cant replace object
92 92 self.msg_struct['entity_name'] = ret['entity_name']
93   - self.msg_struct['from'] = ret['from']
  93 + self.msg_struct['origin'] = ret['origin']
94 94 self.msg_struct['version_firmware'] = ret['version_firmware']
95 95 self.msg_struct['site'] = ret['site']
96 96 self.msg_struct['date'] = ret['date']
... ...
simulators/plc/plcSimulator.py
... ... @@ -4,6 +4,7 @@ import os
4 4 import sys
5 5 import json
6 6 import time
  7 +import logging
7 8 import urllib.request
8 9  
9 10 DEBUG_FILE = True
... ... @@ -11,6 +12,11 @@ PACKAGE_PARENT = '..'
11 12 SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
12 13 sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
13 14  
  15 +#(_path = os.path.abspath("..")
  16 +#(sys.path.insert(0, _path )
  17 +import logconf
  18 +logger = logging.getLogger(__name__)
  19 +
14 20 #(EP renamed) from utils.Device import Device
15 21 from utils.DeviceSim import DeviceSim
16 22 from utils.StatusManager import StatusManager
... ... @@ -121,10 +127,12 @@ class PLCSimulator(DeviceSim, StatusManager):
121 127 self.my_worker = WorkerUrl(self.my_state, self.status)
122 128 self.my_worker.start()
123 129 self.my_state.status = 'init'
  130 + logger.info('Enter loop_3')
124 131 while (self.my_state.worker == 'start'):
125 132 if (self.isConnected()):
126 133 self.handleConnections()
127 134 time.sleep(0.5)
  135 + logger.info('Exit loop_3')
128 136 self.my_state.worker == 'stop'
129 137  
130 138 def loop_2(self):
... ...
src/dashboard/templates/dashboard/config_weather.html
... ... @@ -4,7 +4,7 @@
4 4  
5 5 <div class="row">
6 6  
7   - <h1 id="none">Weather config for {{weather_config.origin.plc_from}} {{weather_config.origin.plc_site}}</h1>
  7 + <h1 id="none">Weather config for {{weather_config.origin.plc_origin}} {{weather_config.origin.plc_site}}</h1>
8 8  
9 9 <div class="well">
10 10 Captors list:
... ...
src/monitoring/plc_checker.py
... ... @@ -10,7 +10,7 @@ class PlcChecker(object):
10 10  
11 11 def __init__(self):
12 12 self.origin = {}
13   - self.origin["plc_from"] = None
  13 + self.origin["plc_origin"] = None
14 14 self.origin["plc_site"] = None
15 15 self.struct = None
16 16 self.path_list = None
... ... @@ -81,11 +81,12 @@ class PlcChecker(object):
81 81  
82 82 def same_origin(self):
83 83 # check new origin
84   - if self.struct["from"] == self.origin["plc_from"] and self.struct["site"] == self.origin["plc_site"]:
  84 + print('?')
  85 + if self.struct["origin"] == self.origin["plc_origin"] and self.struct["site"] == self.origin["plc_site"]:
85 86 return True
86 87 else:
87 88 # update origin
88   - self.origin["plc_from"] = self.struct["from"]
  89 + self.origin["plc_origin"] = self.struct["origin"]
89 90 self.origin["plc_site"] = self.struct["site"]
90 91 # init sensors_monitor
91 92 self.init_sensors_monitor()
... ...