Tag Even Change Based on Time of Running Timer Tag

Can someone help me figure out how to get the below script working? It works for the first specified execution and tag path (WC216), but doesn’t work for the next two tag paths. Is this because the time is no longer what it needs to be to run the script? If so, how can I overcome this? I’d really appreciate any help. Thanks!

def wcStatusOff(tagPath):
	
		dsKey = 6057
                workcenterKey = system.tag.read(tagPath + '/Workcenter/Workcenter_Key').value
		paramters = {"Workcenter_Key": workcenterKey}
		result = system.cumulus.ds.exec(webServiceId,dsKey,paramters)


		if 'resultSet' in result.keys():

			for row in result['resultSet']:

						if len(row['Logged_Operators']) == 0:

										webServiceId = system.tag.read(tagPath + '/Web_Service_ID').value
										plcName = system.tag.read(tagPath + '/Workcenter/PLC_Name').value
										status = system.cumulus.request.Production.updateStatus(webServiceId,'6065',plcName,'Off','')							   

										if status['outputParameters']['Result_Error'] == 'True':

														print 'Error'

										else:

														print 'Success'
														system.tag.write(tagPath + '/Workcenter/Workcenter_Status','Off')
														
	                                                                                               
	
wcStatusOff('HMI_Lite/PLCs/WC216')
wcStatusOff('HMI_Lite/PLCs/WC216')	
wcStatusOff('HMI_Lite/PLCs/WC216')

My mistake, I didn’t paste the first line in. Please see below.

if ‘07:03:00’ in str(currentValue) or ‘13:18:00’ in str(currentValue) or ‘15:33:00’ in str(currentValue) or ‘20:03:00’ in str(currentValue) or ‘22:15:00’ in str(currentValue) or ‘01:33:00’ in str(currentValue):

def wcStatusOff(tagPath):

	dsKey = 6057
            workcenterKey = system.tag.read(tagPath + '/Workcenter/Workcenter_Key').value
	paramters = {"Workcenter_Key": workcenterKey}
	result = system.cumulus.ds.exec(webServiceId,dsKey,paramters)


	if 'resultSet' in result.keys():

		for row in result['resultSet']:

					if len(row['Logged_Operators']) == 0:

									webServiceId = system.tag.read(tagPath + '/Web_Service_ID').value
									plcName = system.tag.read(tagPath + '/Workcenter/PLC_Name').value
									status = system.cumulus.request.Production.updateStatus(webServiceId,'6065',plcName,'Off','')							   

									if status['outputParameters']['Result_Error'] == 'True':

													print 'Error'

									else:

													print 'Success'
													system.tag.write(tagPath + '/Workcenter/Workcenter_Status','Off')

wcStatusOff(‘HMI_Lite/PLCs/WC216’)
wcStatusOff(‘HMI_Lite/PLCs/WC216’)
wcStatusOff(‘HMI_Lite/PLCs/WC216’)

I didn’t look close, because your indentation is messed up. You can’t mixed indenting by spaces with tabs. And really, with tabs, just use one for each level.

Thanks for the reply. In my actual script, the indentation is correct. I copied and pasted from a notepad file and somehow the indentation got messed up.

Tim, did you ever get this resolved? You probably have, but more importantly I noticed you are using the Cumulus module. Is that to PLEX. My company is doing a bunch of development in this area and I was excited to see someone else who is doing it too. Are you using PLEX?