Get the device that triggers the scene

Hi all,
I have a scene that can be called by large number of devices (using triggers) and in the scene Luup code I would like to retrieve the device that triggers the scene.
I tried with “lul_device” but returned nil :confused:

Is there a way to do that ?

I’m not sure if possible without parsing the logs.

  • Garrett

There are two LUA code sections in a scene: The event trigger LUA code, and the scene’s LUA code. The event trigger LUA code is naturally run before the scene’s LUA code.

So set a global flag in the Event LUA code section?

He would have to add lua code for each trigger to either log the trigger or notify the of the trigger via some notification. Can be tedious.

  • Garrett

Agree with you but it works.
On each trigger luup code I put “luup_device = xxx” where “xxx” is the device id that triggers
The luup_device variable exists in the luup scene code.

Maybe there is a better solution…

Agree with you but it works.
On each trigger luup code I put “lul_device = xxx” where “xxx” is the device id that triggers
The lul_device variable exists in the luup scene code.

Maybe there is a better solution…[/quote]

Hi. UI7 has taken away the option to include separate lua code for each device (although, oddly, existing code entered in UI5 still seems to work). Did anyone come up with a more elegant Sutton to working out which device triggered a particular scene?

David

I believe this has been reported as a bug, so hopefully the UI7 interface will be fixed soon so that LUA code can again be added to the trigger.

Which is why I have not upgraded to UI7.