Skip to content

Activities

Patrick Rigney edited this page Apr 8, 2019 · 10 revisions

Reactor can run actions directly, without relying on Vera scenes. These "activities" are run when the ReactorSensor trips or untrips, or when a Reactor group changes state (e.g. from false to true or vice versa).

The following action types are available in Reactor Activities:

  • Device Action - Run an action on a device (e.g. turn a light on or off, change dimming level or thermostat mode, etc.);
  • Run Lua - Run a Lua script;
  • Run Scene - Run a Vera scene;
  • Delay - Delay execution of subsequent actions in the activity;
  • Change House Mode - Change the current house mode;
  • Comment - A comment to help you document your activity.

Activities and Action Execution

Activities are "durable" across restarts and reloads of Luup. Delayed actions are run at their scheduled times, or as close as possible (if the time is missed during restart/reload, it runs immediately when reload completes).

For every group, and for the overall state of the ReactorSensor itself, there is a true and false activity (the ReactorSensor-level activities are referred to as the trip and untrip activities for historical reasons). The true activities are run when the group/sensor goes true, and the false activities are run when the sensor goes false.

When switching between true and false states, it's possible that delayed actions from the previously-started activity, called the counter-activity, are still running or waiting to run. If there are actions for the group's new state, the counter-activity will be stopped--the delayed actions will be cancelled and not allowed to run. If there are no actions for the group's new state, the counter-activity will be allowed to complete. For example, if you have a ReactorSensor with trip actions that turn on a light, delay 60 seconds, and then turn off the light, and your ReactorSensor untrips during the 60-second delay period and there are untrip actions, the turn off of the light will never happen. But, if there are no untrip actions, the trip activity will be allowed to complete and turn off the light as scheduled.

Note: The existence of any action, even just a comment, in a group state's activity is sufficient to stop the counter-activity. So, if you have a trip activity with several actions and delays, and you want those to stop on untrip, putting a comment in the untrip activity as the sole action is sufficient to stop the trip activity on untrip.

If your ReactorSensor has several groups with activities, it is possible for multiple activities to be run, if several groups change state at the same time and have activities associated with those states. Group activities are started first, in a (post-order (LRN) traversal)[https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(LRN)] order; the overall ReactorSensor trip/untrip activity is the last to be started.

The foregoing describes the order in which activities are started. But if, for example, two groups have equal delays, there is no guarantee with respect to which group will resume first when the delay period expires.

Comment Action

The comment action doesn't actually do anything, it's just a placeholder for text that you can use to document your activity.

It does have one special feature: if the first character is a "*", the comment text is written to the ReactorSensor's event log, which can be seen in the Logic Summary (Tools tab).