Detect which scene triggered

The light is turned on with 3 different scenes.

1st scene: movement
2nd scene: Manual
3rd scene: only when night is and the TV is on

Scene 4: Turns off the light when the TV is turned off.

How to make a script luup to scene 4 will only work when the light is triggered by scene 3?

Here’s one possibility: add a virtual switch that is only turned on by scene 3. Then make scene 4 conditional on that virtual switch being true. Scene 4 should also turn off the virtual switch when it runs.

You used to be able to put Lua code into individual triggers in UI5… not sure if that’s still possible in UI7?

Anyway, if so, you can set a global variable to a unique value within each trigger code and then test which it is in the scene Lua itself.


As an aside, openLuup has a variable lul_scene, available for testing within the scene code, which gives the current running scene number.

jswim788 - It’s works! Thanks. :slight_smile: