Executing a scene from a scene

Apologies to all if I’ve missed it but I haven’t been able to find in the forums or the help how to “nest” scenes, or, to execute one from another if you like. I’m sure it’s simple and I’m missing something…

While cryptic, this:
http://wiki.micasaverde.com/index.php/Luup_Scenes_Events#Run_Scene_.235

and this 2yr old request to simplify it, in order to make it easier for users:
http://bugs.micasaverde.com/view.php?id=1425

Both attempt to do it, at least for Lua programmers. There is no built-in declarative mechanism to do it in scenes, unfortunately, which would also be a logical option for end-users (not forcing them to write Lua, or use a Plugin.

ie. Something in the Scene editor that let you pick a[nother] Scene to embed (for modularity)

I have added a RunScene action to the PLEG and PLTS plugins.
If you have either of these plugins, in the Advanced tab of your Scene you can request that one of these Plugins run your scene.

For those that don’t use PLEG or PLTS, the run_scene code is quite straight-forward and can be included in your Startup Lua (or in a module included there.)

function run_scene (name)
	for i,d in pairs (luup.scenes) do			-- search the table of scenes
		if d.description == name then			-- for the right name
			luup.call_action(
				 "urn:micasaverde-com:serviceId:HomeAutomationGateway1", 
				 "RunScene", 
				 {SceneNum = tostring(i)}, 
				 0) 
			 break					-- quit having found the right scene
		end
	end	
end

This can be used by any scene (or trigger) Lua:

run_scene "sceneName"

It would indeed be nice if this was included in the standard luup module.

Grateful thanks to all. Richard, I am using PLEG and have PLTS installed so will try this. I’m currently having issues with PLEG and VContainer - when I specify a VContainer as the device, PLEG suggest v1 value goes above as an option, which is fine, and I put in the number that I want - 19 in this case, and PLEG fails to save the whole string, instead it saves “v1 value goes above” and omits the value. The VContainer is from the Netatmo script and v1 contains the temperature in degrees C. I am monitoring two rooms, and asking PLEG to act if room a is warm and room b is cold. I also added if the night and day plugin says it is night, then took that out as it wasn’t working, however it still doesn’t work. What I had was if warm lounge and night time and cold bedroom, now if have if warm lounge and cold bedroom, but even if I remove the VContainer reference and change it to light a is on, still noting happens. I tried adding a schedule, still nothing. Can repeat and provide report screen snapshot if it helps. Are PLEG and PLTS integrated, do they affect each other? I have nothing set in PLTS at present.

Please move this post if more appropriate elsewhere. Thank you.

Please open a thread in the Program Logic Plugins section.
PLEG and PLTS share code, but that’s it … there is no linkage between a PLEG device and a PLTS device.

I have not used a Virtual Container … Are you having problems adding a VContainer Input Trigger or a VContainer Device Property ?

I use VirtualContainer (VC) with PLEG. I reference the VC variables as Device Properties in PLEG and perform the numeric comparisons in the condition statements. It has been working perfectly for many months. (Reaches out to touch nearby piece of wood ;D).

Thank you both. Yes Richard, as an Input, so now I’ll try as a Device. I was using the thermostat I has (Nest) and saw the VContainer listed as a possible input so changed to that as the Nest is not currently installed. Will post in the proper place from now on, thank you.