how-to: mirroring select openLuup devices/variables on real Vera

It has been a while: I had to go and look at the code to remind myself.

Can I set the openLuup.Mirrors attribute in a plugin as well, or must it be in the startup code?

The openLuup attributes can be read/set at any time by anything. However, unlike other system attributes it is not (for good reasons) stored in the user_data.json file between reloads. This is one reason I recommended that the attribute be set in the startup code. For another reason, read on…

And is it dynamic, i.e. can I set it without a LUA reload?

The value is read by VeraBridge at the time the plugin initialisation code is executed. This is so that the device variable callbacks can be set up. It could be implemented another way dynamically, but isn’t at the moment.

As it stands, you couldn’t guarantee that any plugin you wrote to set the attributes would be executed before VeraBridge starts up. What you could do, if all you want is a better interface, is to write whatever configuration you like into one of your plugin’s variables and then get the startup code to use that to initialise openLuup.Mirrors in the Lua Startup code.

As an aside, I’m thinking of adding optional fields to the mirror syntax, to allow arbitrary target values for serviceId and variable names. Thus you could write:

luup.attr_set ("openLuup.mirrors", [[
172.16.42.14
33.urn:whatever-you-like.SomethingElse = 162.urn:upnp-org:serviceId:TemperatureSensor1.CurrentTemperature
]])