View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1030
Thanks, I went with the default rule as that seems to be enough for now. Should have thought of that myself.

Yes, a getRule(ruleid) method would help getting rid of iterating through a list for a list containing a string. On the other hand the weakness of the script is probably more in the way it creates the alarm rule if one doesn't exist and the way that everything is relying on the string 'Alarm rule'. It seems that the appendRule method doesn't care what ruleid it's fed, it creates a new id for it anyway. That's why the script has to ask for it after creating the rule. Of course, this only applies when there isn't an Alarm rule and I guess I wont be deleting it all the time.

This script does do the job for reacting to an alarm but I still like your idea for setting an alarm as an action.