Scenes versus Reactor in openluup

Rigpapa-

Completing move and total transition to openluup+reactor which is the context for this question:

Are there any benefits (or downsides) to the use of reactor versus scenes in openluup to accomplish the same thing?

When would you favor the inbuilt scene engine versus reactor or vice versa?

Assume openluup is installed in VMware esxi with no performance limits…

The biggest upside to using Reactor for actions is that it manages the completion of the task, including all delayed activity groups, across any reboots or restarts. While that’s less of an issue for openLuup, there is still always the possibility of a power failure or other system event causing a shutdown and later restart. Reactor will resume any unfinished tasks when that occurs.

You can actually use both Luup scenes and Reactor together. If you put your actions in regular Luup scenes as usual and just have your Reactor activities run those scenes, you inherit the benefit of Reactor’s management of scene execution, while still having scenes available as usual in the UI for manual activation or whatever other purpose.

Additionally, Reactor has a RunScene action that is a drop-in replacement for Luup’s action. All you need to do to use it in your Lua code is replace the “0” device number in the action call with the device number of the Reactor master device to have Reactor run and manage the scene. For example, if Reactor is device 444 in your system:

luup.call_action( "urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", { SceneNum=23 }, 0 )
--- becomes:
luup.call_action( "urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", { SceneNum=23 }, 444 )

Having Reactor run your scenes has two limitations, one of which I do not believe applies to openLuup: the scene’s “last run” timestamp is not updated; and any notifications associated with the scene are not run, because there is no Luup API to launch a notification, it’s something Vera handles entirely internally. The second one… I do not believe the notifications mechanism has been reproduced in openLuup (I may be wrong, but I’ve never seen a hint of it).

Hope this helps!

This is true, although a notification is simply a hidden scene which sends messages through one channel or another. You should find code for both email and other mechanisms on the forum (I use Prowl) which can be dropped into scenes or Startup Lua.

I have reproduced it with pushover… Exactly that way. It is a function in my startup lua which then can be called in any scene so I can send whatever notification I want.

The invisible “notification_only” single-purpose scenes always looked like a bit of kludge to me. I can’t wrap my head around what that does differently from watching a state variable and running their notification function directly. Why put it through scene? It just seems like an extra layer of indirection that’s unnecessary in their current notification model.

1 Like

That’s rather why I didn’t implement it in openLuup… “less is more!”

2 Likes

You are not alone. Where I come from, it’s called “bad design”… wasteful cumbersome coding.

thank you all. answered exactly what i needed to know.