GenieACS 1.1.3 preset_loop

hello,

why I am getting this message for preset?

faultCode=“preset_loop” faultMessage=“The presets are stuck in an endless configuration loop”

Maybe too simple an answer, but if something is changing during your preset, maybe in a linked provision, it is going to iterate again until nothing changes.

As an example, for illustrative purposes, not that I can think of a reason to do so

So if you had some code in your provision that sets a tag, with a name that includes the timestamp it was run (i.e. it would be a different tag name set each time it is executed) the script would end up in the “endless configuration loop” because, it would iterate until nothing changed … which would never happen because the tag name is based on when the script runs, changing with each iteration.

Perhaps you have something like this in your preset … creating a new change each time, rather than landing in a static state where no more changes occur.

We find that when calling external scripts, or a set of scripts acting like a state machine, we only want a signle iteration of each provision.

I will explain how we do this, in hopes that it is an opportunity for more experienced users to chime in and let us know what sort of other best practice might or should be used in lieu of our method.

Our method is to use the tags to prevent a provision from iterating more than once. Take for instance the example in suedocode below, where we want to execute Provision A only once per device. Script B will iterate until there are no more tag changes.

Provision A:
Launched from Preset triggers on “2 PERIODIC” inform and TAG is NOT ScriptAExecuting
Sets Tag ScriptAExecuting
Does some stuff
Sets Tag ScriptAExecuted
returns

Provision B:
Launched from Preset triggers on “2 PERIODIC” inform AND when TAG is ScriptAExecuted and TAG is NOT ScriptBExecuting
Sets Tag ScriptBExecuting
Clears Tag ScriptAExecuting
Does some stuff
Sets Tag ScriptBExecuted
Clears Tag ScriptBExecuting
returns

1 Like

Thank you. This helped me a lot . I did it like you said and it’s ok now. I am not getting fault messages after tag was added