Help with "Threat Level" PLEG

Hi

I am thinking about building an enhancement to my security PLEG that performs different actions based on a “Threat level”… For example, I have a bunch of cameras outside hooked up to the BlueIris plugin with motion detection. Sometimes they are tripped by animals etc, so I dont want to do things based on a single trip and certain conditions may be of more interest than others. So I may want to increment threat level by one each time a motion is tripped in a time period. If 2 different cams are tripped in sequence, I might increment by 3 or 4. The level would decrease based on a repeating timer such that the absence of these patterns would mean an gradual decrease of threat level to normal. I would do different things based on where the threat level is.
I am ok with building the conditions I want to increase and decrease the level, but I am looking for advice on the action. Do I have to use variable container or something to hold a number and increment / decrement it, or is there another way without using another plugin, eg via Luup and a variable, or something built into PLEG? Can I even use arithmetic in a PLEG action in this way?

Thanks

PLEG’s State Variable mechanism may be a good way to implement this. This is described in PLEG Basics.

Otherwise you could use a variable in MultiString or just a custom device variable to hold your calculated threat level. In either case, PLEG can update these with its SetVariable action.