I wrote a Protocol that request every hour a server via API Calls to get data and display them in a Table. Meanwhile, I have a counter that counts till 60 min (1 hour). After getting the data, I set the param to 0
Protocol:
groups
200 execute session 200
320 execute Action 320
100 execute session 100
3 execute Action 3
Sessions:
200 Get / Create Token
100 Get data bank information from Server / requires token
triggers:
200 execute Action 200
201 execute Action 201
100 execute Action 100
Actions:
200 execute Group 200
201 clear token
320 execute Group 320
100 execute Group 100
3 timer increase
Qactions (only parsing the data):
100 response of the sessions 100, parsing data and display in a table
320 setting the param from the read write params for the session requests
206 use the token of the session response and save token as param
Timer:
slow timer, 3600000 execute group 320
fast timer, 60000 increment timer
Flowchart:
1. Qaction 320 Fetch the Login data from display input params check Trigger 200
2. Sessions 200 login with the data and get Token back
3. 206 serialize the JSON Response and set the token to the param. Checking trigger 100
4. Sessions 100 use the token and request the data
5. Qaction 100 parsing the response from session 100 and display on table, set the counter to 0
The problem is that every hour sometimes all triggers getting executed, sometimes trigger 100 don't be executed (see log).
Log:
Success:
2024/06/10 10:03:54.455|SLManagedScripting.exe|ManagedInterop|CRU|-1|480|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 10:03:54.857|SLManagedScripting.exe|ManagedInterop|CRU|-1|480|das ist der token der gecleart wird
2024/06/10 10:03:54.857|SLManagedScripting.exe|ManagedInterop|CRU|-1|480|tokenoperaotr 207
2024/06/10 10:03:54.858|SLManagedScripting.exe|ManagedInterop|CRU|-1|480|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 10:03:55.266|SLManagedScripting.exe|ManagedInterop|CRU|-1|518|check trigger 2 clear table and before iteration
2024/06/10 10:03:55.278|SLManagedScripting.exe|ManagedInterop|CRU|-1|518|only all Rail check loop
2024/06/10 10:03:55.278|SLManagedScripting.exe|ManagedInterop|CRU|-1|518|before setting the counter to 0 60
2024/06/10 10:03:55.278|SLManagedScripting.exe|ManagedInterop|CRU|-1|518|after setting the counter to 0 0
2024/06/10 10:03:55.286|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/10 10:03:55.287|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 0 to 1
Fails:
2024/06/10 11:03:54.485|SLManagedScripting.exe|ManagedInterop|CRU|-1|458|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200
2024/06/10 11:03:54.977|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|das ist der token der gecleart wird
2024/06/10 11:03:54.977|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|tokenoperaotr 207
2024/06/10 11:03:54.977|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 11:04:26.851|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 1 to 2
2024/06/10 11:04:26.851|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 2.
2024/06/10 11:08:26.908|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 2 to 5
2024/06/10 11:08:26.908|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 5.
Success:
2024/06/10 12:03:54.548|SLManagedScripting.exe|ManagedInterop|CRU|-1|515|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 12:03:55.086|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|das ist der token der gecleart wird
2024/06/10 12:03:55.086|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|tokenoperaotr 207 :
2024/06/10 12:03:55.087|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 12:03:55.326|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|check trigger 2 clear table and before iteration
2024/06/10 12:03:55.340|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|only all Rail check loop
2024/06/10 12:03:55.341|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|before setting the counter to 0 120
2024/06/10 12:03:55.341|SLManagedScripting.exe|ManagedInterop|CRU|-1|322|after setting the counter to 0 0
2024/06/10 12:03:55.349|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/10 12:03:55.352|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 0 to 1
2024/06/10 12:03:55.357|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 5 to 1
2024/06/10 12:03:55.357|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 1.
Success:
2024/06/10 13:03:54.601|SLManagedScripting.exe|ManagedInterop|CRU|-1|428|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 13:03:55.011|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|das ist der token der gecleart wird 2024/06/10 13:03:55.011|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|tokenoperaotr 2024/06/10 13:03:55.012|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 13:03:55.236|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|check trigger 2 clear table and before iteration
2024/06/10 13:03:55.253|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|only all Rail check loop
2024/06/10 13:03:55.253|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|before setting the counter to 0 60
2024/06/10 13:03:55.253|SLManagedScripting.exe|ManagedInterop|CRU|-1|501|after setting the counter to 0 0
2024/06/10 13:03:55.264|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/10 13:03:55.267|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 0 to 1
Fails (doesn't execute trigger 100):
2024/06/10 14:03:54.636|SLManagedScripting.exe|ManagedInterop|CRU|-1|470|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 14:03:55.079|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|das ist der token der gecleart wird
2024/06/10 14:03:55.079|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|tokenoperaotr 207 :
2024/06/10 14:03:55.079|SLManagedScripting.exe|ManagedInterop|CRU|-1|447|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 14:04:28.299|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 1 to 2
2024/06/10 14:04:28.299|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 2.
2024/06/10 14:08:28.332|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 2 to 5
2024/06/10 14:08:28.332|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 5.
Fails (doesn't execute trigger 100):
2024/06/10 15:03:54.688|SLManagedScripting.exe|ManagedInterop|CRU|-1|125|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 15:03:55.090|SLManagedScripting.exe|ManagedInterop|CRU|-1|476|das ist der token der gecleart wird
2024/06/10 15:03:55.090|SLManagedScripting.exe|ManagedInterop|CRU|-1|476|tokenoperaotr 207 :
2024/06/10 15:03:55.090|SLManagedScripting.exe|ManagedInterop|CRU|-1|476|excuting triggers 201 clear token and trigger 100 get the layouts
Fails (doesn't execute trigger 100):
2024/06/10 16:03:54.738|SLManagedScripting.exe|ManagedInterop|CRU|-1|458|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 16:03:55.164|SLManagedScripting.exe|ManagedInterop|CRU|-1|367|das ist der token der gecleart wird
2024/06/10 16:03:55.164|SLManagedScripting.exe|ManagedInterop|CRU|-1|367|tokenoperaotr 207 :
2024/06/10 16:03:55.165|SLManagedScripting.exe|ManagedInterop|CRU|-1|367|excuting triggers 201 clear token and trigger 100 get the layouts
Success:
2024/06/10 17:03:54.802|SLManagedScripting.exe|ManagedInterop|CRU|-1|495|The param are url ias/v3/token/actions/signOnByUserNamePassword token body is after trigger 200 checked
2024/06/10 17:03:55.191|SLManagedScripting.exe|ManagedInterop|CRU|-1|220|das ist der token der gecleart wird
2024/06/10 17:03:55.191|SLManagedScripting.exe|ManagedInterop|CRU|-1|220|tokenoperaotr 207
2024/06/10 17:03:55.191|SLManagedScripting.exe|ManagedInterop|CRU|-1|220|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/10 17:03:55.380|SLManagedScripting.exe|ManagedInterop|CRU|-1|516|check trigger 2 clear table and before iteration
2024/06/10 17:03:55.383|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/10 17:03:55.387|SLManagedScripting.exe|ManagedInterop|CRU|-1|516|only all Rail check loop
2024/06/10 17:03:55.387|SLManagedScripting.exe|ManagedInterop|CRU|-1|516|before setting the counter to 0 240
2024/06/10 17:03:55.387|SLManagedScripting.exe|ManagedInterop|CRU|-1|516|after setting the counter to 0 0
2024/06/10 17:03:55.398|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 0 to 1
2024/06/10 17:03:55.399|SLElement.exe|15000|CParameter::SetElementState|DBG|0|** parameter alarmstate 3/ from 5 to 1
2024/06/10 17:03:55.399|SLElement.exe|15000|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 1.
2024/06/10 17:12:00.176|SLProtocol - 5004 - Rail Monitor|20312|CProtocol::HandleAnotherTelnetClient|DBG|0|Telnet clients connected Primary = 1, Derived = 0
**********
Any ideas ?
Thanks you in advance
Hi, Thank you for the fast response, I changed the timer to 10 min and I watched the stream viewer. The group still get correct response and the correct JSON, but I don't know why the Qaction still not executing see the picture below.
I needed blurred sensitive data.
So if I am correct, understand I just need to add in my trigger 100
Trigger id="100">
<Name>show me data</Name>
<Type>action</Type>
<Content>
<Id>100</Id>
</Content>
</Trigger>
to
Trigger id="100">
<Name>show me data</Name>
<On id="200">group</On>
<Time>after</Time>
<Type>action</Type>
<Content>
<Id>100</Id>
</Content>
</Trigger>
is That correct ? Cause in the Qaction I already use the function "protocol.CheckTrigger(100);"
thank you in advance
Ah, thank you know I understand thank you
cause the login changes every time (creates new token) that’s why get executed
But the request the data “mostly” never changes, so it’s not triggered, right?
To your question:
my Qaction 320 is for the parsing login parameter from displayed params after its has “protocol.CheckTrigger(200);”
trigger200: run actions –> actions 200: execute group 200 execute next
Group 200 (creates session 200 ) requests the token after that
in Qaction 200 parse the token in a param
protocol.CheckTrigger(100);
with the token the group 100 executes and get the response JSON
but the Qaction 100 (parsing response) don’t execute
Sometimes it’s executing correct after the specific time, sometimes it don’t execute like here (counter from 1410 set to 0) :
2024/06/12 10:30:14.669|SLManagedScripting.exe|ManagedInterop|CRU|-1|443|excuting triggers 201 clear token and trigger 100 get the layouts
2024/06/12 10:30:15.551|SLManagedScripting.exe|ManagedInterop|CRU|-1|497|check trigger 2 clear table and before iteration
2024/06/12 10:30:15.583|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 5 to 0
2024/06/12 10:30:15.603|SLManagedScripting.exe|ManagedInterop|CRU|-1|497|only all Rail check loop
2024/06/12 10:30:15.603|SLManagedScripting.exe|ManagedInterop|CRU|-1|497|before setting the counter to 0 1410
2024/06/12 10:30:15.603|SLManagedScripting.exe|ManagedInterop|CRU|-1|497|after setting the counter to 0 0
from 1410 min set counter to 0
23,5 Hours passed
The most strange thing on it is:
I set the trigger interval to every 10 minutes; it should be executing properly.
That’s make 141 times should the triggered, but it does after 23 hours
for now is working fine every 10 min
2024/06/12 11:09:47.532|SLManagedScripting.exe|ManagedInterop|CRU|-1|478| check trigger 2 clear table and before iteration
2024/06/12 11:09:47.555|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/3 from 5 to 1
2024/06/12 11:09:47.556|SLElement.exe|24980|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 1.
2024/06/12 11:09:47.558|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/12 11:09:47.590|SLManagedScripting.exe|ManagedInterop|CRU|-1|478|only all Rail check loop
2024/06/12 11:09:47.590|SLManagedScripting.exe|ManagedInterop|CRU|-1|478|before setting the counter to 0 10
2024/06/12 11:09:47.590|SLManagedScripting.exe|ManagedInterop|CRU|-1|478|after setting the counter to 0 0
2024/06/12 11:19:47.548|SLManagedScripting.exe|ManagedInterop|CRU|-1|449|check trigger 2 clear table and before iteration
2024/06/12 11:19:47.564|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/3 from 5 to 1
2024/06/12 11:19:47.564|SLElement.exe|24980|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 1.
2024/06/12 11:19:47.565|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/12 11:19:47.598|SLManagedScripting.exe|ManagedInterop|CRU|-1|449|only all Rail check loop
2024/06/12 11:19:47.598|SLManagedScripting.exe|ManagedInterop|CRU|-1|449|before setting the counter to 0 10
2024/06/12 11:19:47.598|SLManagedScripting.exe|ManagedInterop|CRU|-1|449|after setting the counter to 0 0
2024/06/12 11:29:47.762|SLManagedScripting.exe|ManagedInterop|CRU|-1|200|check trigger 2 clear table and before iteration
2024/06/12 11:29:47.777|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/3 from 5 to 1
2024/06/12 11:29:47.777|SLElement.exe|24980|CElement::NotifyAlarmState|DBG|0|** Element Alarmstate changed to 1.
2024/06/12 11:29:47.779|SLElement.exe|24980|CParameter::SetElementState|DBG|0|** parameter alarmstate 1004/0 from 1 to 0
2024/06/12 11:29:47.815|SLManagedScripting.exe|ManagedInterop|CRU|-1|200|only all Rail check loop
2024/06/12 11:29:47.816|SLManagedScripting.exe|ManagedInterop|CRU|-1|200|before setting the counter to 0 10
2024/06/12 11:29:47.816|SLManagedScripting.exe|ManagedInterop|CRU|-1|200|after setting the counter to 0 0
Sorry, I don’t immediately see what could cause the problem.
How to make that the trigger always triggers like you said and not dependent on the response ?
So hopefully I can fix the problem
Hi Ömer, is your QAction that processes the response still triggering on the response parameter in the HTTP session? Do note that the QAction will only get triggered when the value changes. If the response doesn’t change, the QAction won’t get triggered.
You’re code seems correct, but the trigger should eventually trigger the QAction via a dummy parameter, not via the response parameter anymore.