Fixes driver. This file runs & works.

This commit is contained in:
Patrick McDonagh
2016-06-14 19:06:35 -05:00
parent 9035959a1b
commit 706c40a4ed
2 changed files with 9 additions and 6 deletions

View File

@@ -60,7 +60,9 @@ maps = {
16: "Failure to Stop", 16: "Failure to Stop",
17: "Failure to Start", 17: "Failure to Start",
18: "Drive Fault" 18: "Drive Fault"
} },
None: None,
'null': None
} }
# ---------- TAGS ---------- # # ---------- TAGS ---------- #
stroke_tags = {} # Tags stored for every single stroke stroke_tags = {} # Tags stored for every single stroke
@@ -159,19 +161,19 @@ def setupTags():
tags = json.loads(get_tag_request.text) tags = json.loads(get_tag_request.text)
for t in tags: for t in tags:
if t['tag_class']['class_type'] == 'stroke': if t['tag_class']['class_type'] == 'stroke':
stroke_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']]) stroke_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type']['plc_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']])
elif t['tag_class']['class_type'] == 'history': elif t['tag_class']['class_type'] == 'history':
history_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']]) history_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type']['plc_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']])
elif t['tag_class']['class_type'] == 'gaugeoff': elif t['tag_class']['class_type'] == 'gaugeoff':
gaugeoff_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']]) gaugeoff_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type']['plc_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']])
elif t['tag_class']['class_type'] == 'welltest': elif t['tag_class']['class_type'] == 'welltest':
welltest_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']]) welltest_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type']['plc_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']])
elif t['tag_class']['class_type'] == 'custom': elif t['tag_class']['class_type'] == 'custom':
custom_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']]) custom_tags[t['name']] = Tag(t['name'], t['tag'], t['id'], t['data_type']['plc_type'], t['change_threshold'], t['guarantee_sec'], mapFn=maps[t['map_function']], ip_address=t['deviceID']['address'], device_type=device_types[t['deviceID']['device_type']])
get_event_request = requests.get('{}/event_config'.format(web_address)) get_event_request = requests.get('{}/event_config'.format(web_address))
events = json.loads(get_event_request.text) events = json.loads(get_event_request.text)

View File

@@ -7,6 +7,7 @@ with open(os.path.realpath('.') + '/mysql_cfg.pickle', 'rb') as cfgFile:
mysql_cfg = pickle.load(cfgFile) mysql_cfg = pickle.load(cfgFile)
con = mysqlcon.connect(**mysql_cfg) con = mysqlcon.connect(**mysql_cfg)
def readConfig(): def readConfig():
configProperties = {} configProperties = {}
configObj = {} configObj = {}