OK. The news of Vera/MiOS has clearly created a lot of distractions, and some very exciting discussion about what may be to come, but for the foreseeable future we still have to live with the hardware and software we’ve got, good, bad and otherwise, so I of course will continue to press forward delivering what I hope are useful features. And as I’ve said, hopefully some day, Vera will do an amazing job of its own scene logic and Reactor can quietly ride off into the sunset.
The current stable pre-release of Reactor has been updated and is installable from the AltAppStore directly, or from the stable branch on Github (for convenience, download the stable release ZIP file); see the README.md file for installation instructions.
New stuff:
First, Reactor will now run scenes directly. It is no longer necessary to use a device trigger on your scene that watches your ReactorSensor. There is a new “Activities” tab in ReactorSensor configuration that allows you to specify a “Trip” scene, and an “Untrip” scene. Reactor will run these scenes when the associated ReactorSensor becomes tripped or untripped, respectively. If you decide to let Reactor run the scenes itself (and I think you will when you’ve finished reading this), you should/must turn off your device triggers in the scenes used by Reactor, otherwise the scenes will be run twice (once for the scene’s native trigger, and again when Reactor runs it). Scenes used in the Activities tab should always use “Manual” triggering in the scene definition.
Second and more exciting, in my opinion, is HOW Reactor runs scenes when you let it. Reactor doesn’t simply call Vera’s [tt]RunScene[/tt] action, it runs the scene entirely itself, step by step, including any scene Lua that you’ve defined (and that works the same way–if your scene Lua returns false, the scene activities aren’t run, otherwise they run).
The most important benefit of Reactor’s scene runner is that scenes survive restarts of Luup for delayed activity groups. We all know too well that, normally, if a scene has a delayed activity group, and Luup reloads for some reason during the delay period, the timing is lost and the delayed actions never run. So since the earliest days of Vera, it’s been a frustration that a simple “turn the light off in five minutes” scene could never work reliably (at least, not without adding considerable complexity to help).
When Reactor runs the scene, however, the scene elements are scheduled and execution tracked by Reactor’s internal task scheduling. If Luup restarts, Reactor will simply resume running any scenes that were running prior to the event from where they left off, until all activity groups in the scene have completed. If a group’s scheduled time passes during the event, Reactor will run the “late” actions immediately on restart, in correct schedule order, and then all remaining activity groups will be run on time relative to the original start time of the scene. That is, if the delay for a group is 10 minutes, that means it will run 10 minutes from when the scene originally was started, on schedule, as if the reload interruption never occurred.
This improved scene runner is available to all scenes on your Vera when you have Reactor installed, including scenes you run from your own custom Lua or PLEG actions. Here’s how you use it:
[ul][li]For existing scenes that are triggered by device triggers or schedules on the scene itself, move those trigger conditions into a ReactorSensor, then remove the triggers from the scene, and configure Reactor to run the scene (on the Activities tab);[/li]
[li]For PLEG actions, use Reactor’s “RunScene” action instead of PLEG’s–select the Reactor (master) device, and choose the “RunScene” action and enter the scene number or name;[/li]
[li]In your custom Lua, just use [tt]luup.call_action( “urn:toggledbits-com:serviceId:Reactor”, “RunScene”, { SceneNum=string-or-number }, reactorDeviceNum )[/tt]. The “SceneNum” parameter takes a scene number or scene name.[/li][/ul]
An additional feature of Reactor’s scene runner is that you can stop a running scene. There is a “StopScene” action in the Reactor service that allows you to stop a single specified scene if it is running, or stop all scenes that Reactor is running (specificy SceneNum=0). This is also accessible from PLEG and your own Lua.
Finally, this version has some big improvements to the scheduling of most time/date-based conditions, to further reduce load on the Vera.
I plan on releasing this version in the Vera Plugin Marketplace over the weekend for access there on Monday. Until then, if you want to try this stuff out, Github is the way to go.