I need to be able to take action within a function based on the ID number of the scene that called the function?
I realise I could set a variable to the scene number before calling the function. But does anyone know a way to obtain this from Vera itself? - a neater solution.
AFAIK, there is no good way. This is simply another thing which Vera/MiOS forgot.
In my own emulation of MiOS, openLuup, I implemented a variable lul_scene, in the same spirit as lul_device, because I could find no valid alternative.
Thanks, that’s what I suspected - unless anyone comes up with a better way, I will need to set a variable before the function call.
There used to be Lua code that could be run for individual triggers. I believe that UI access to that may have gone away, but I think that it is still functional within the system. It can be set by defining the scene in JSON and running an HTTP request. Might help.
I simply define a global table and reference the ids this way.
Then I call my function passing the id. Something like scenes.frontdooropen.
Tricky but working OK for me and not related to scene ids at all.
My other potential method is to have multiple functions, one for each scene I wish to reference - just name them differently.