For the benefit of anyone else looking to increment variables and use them in alerts, here?s what is working for me:
I have an action that starts then stops after 10 seconds. I send a push notification when it starts. Then it waits 1 minute and repeats for another 10 seconds. The process is repeated over and over until it?s aborted. Think of it as light on for 10 seconds, light off for 1 minute, light on for 10 seconds, etc. When it?s aborted I send another push notification. So I?ve got conditions called startAction, repeatAction and abortAction.
My goal is to send out a push notification each time it repeats with the cycle number. Something like ?Repeat #1?, ?Repeat #2?, etc.
In order to achieve this I added a variable to the push notification device under Advanced → New Service settings. In PLEG I add a device property that reads my variable. In my actions for the startAction condition I add my PLEG device and under advanced I select SetVariable. I use the same service id, device id and variable name that I setup in my device. The value is set to 0 to reset the counter. Next for my repeatAlert action I add my PLEG device again and for the value I use: {(pAlertIt + 1)}
In this example my variable is called alertIt so I called the property pAlertIt. After that I add my push notification device to the action and set the message as:Alert #{(pAlertIt)}
So it basically increments the value of pAlertIt by 1 first then reads the new value when it forms the message. Lastly, for abortAction I add the same action I added for startAction. For the PLEG device I select setVariable and set the value to 0. When the startAction or AbortAction happen, the device property, alertIt is reset to 0. As it?s repeating it increments alertIt by 1 and sends a push notification.
Hope this helps.