Recursively calling an action group

Posted on
Wed Jul 03, 2019 5:33 am
steve offline
Posts: 31
Joined: Apr 30, 2013

Recursively calling an action group

I'm on v 6.0.21 for hardware reasons.

I'm trying to program around a Marmitek PH7208 siren (please no flames about X10: I have an XTBR booster/router/deconflicter and everything is working just great). This tiresome device (the siren, not the booster) does not obey normal X10 'on' and 'off' commands, but instead requires a continuous stream of 'on/off' commands to keep it sounding - possibly an attempt to make it more 'reliable' in the face of X10's increasing susceptibility to mains crud from switching power suppliers and CF lightbulbs.

I see that it's possible for action groups to call themselves recursively, and I've reviewed the posts on recursion on the forums. Clearly, sending a continuous stream of 'on/off' commands is most easily achieved by a recursive action group, which saves setting up timers and triggers and whatnot. My question: assuming that the outgoing command stream isn't interrupted in any way, would that be ok practice, or is a stack overflow or recursion trap hit likely?

Steve

Posted on
Wed Jul 03, 2019 8:18 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Recursively calling an action group

No, calling an action group recursively isn't recommended. Indigo will notice it and kill it after some number of iterations (see the Infinite loop detection in the prefs). But even if Indigo didn't, you would have no way to stop it later - it would literally run until you restarted the server.

A better approach is to create a schedule that executes the action group every X seconds. You can the enable the schedule when you want the siren to sound and disable the schedule when you don't (or whatever the appropriate logic is) using the enable/disable actions for schedules.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest