Creating a new expression tag that when holds a True value runs one of my functions every 5 seconds.
Tag Diagnostics state “Error evaluating tag: Error executing script for runScript() expression:shared.ofs.main.monitorPtValueReset()”
Within the expression the code written is
runScript("shared.ofs.main.monitorPtValueReset()", 5000)
The function is created to intermittently check the line status and stop downtime spans once the line is running. Code is as follows:
def monitorPtValueReset(tagPath):
readURL = SERVER + TEST_LINE + LINE_POSTFIX + RUNNING_CHECK_ENDPOINT
response = system.net.httpGet(readURL, username=USER, password=PASS)
r = system.util.jsonDecode(response)
if(r['spanClass'] == 'Running'):
running = True
else:
running = False
if (running):
#Build corresponding monitor point paths
currentLine = tagPath.split('/')[0]
currentLinePost = tagPath.split('/')[1]
current_SMP_path = currentLine + "/" + currentLinePost + "/MP_SKUChange"
current_BMP_path = currentLine + "/" + currentLinePost + "/MP_BatchChange"
# there will be instances where one MP is true while the other is false
# to prevent object finding issues, only run reset on MP that requires it
current_SMP_status = system.tag.read(current_SMP_path).value
if (current_SMP_status):
# reset monitor points and stop relative spans via endpoint
system.tag.write(current_SMP_path, False)
endpointURL = SERVER + TEST_LINE + LINE_POSTFIX + SIZE_STOP
system.net.httpGet(endpointURL,username=USER, password=PASS)
current_BMP_status = system.tag.read(current_BMP_path).value
if (current_BMP_status):
system.tag.write(current_BMP_path, False)
endpointURL = SERVER + TEST_LINE + LINE_POSTFIX + BATCH_STOP
system.net.httpGet(endpointURL,username=USER, password=PASS)
I’m hoping a pair of fresh eyes can help resolve the error. Thank you