I was reading a request for PLEG to incorporate an import and export feature for logic to help users share stuff.
That got me thinking about sharing of stuff in general, since code is tied to device ID’s, and complex pieces of code that aren’t plugins where you can define stuff could be a pain to change to match your system.
Too bad there is no way to create an alias in Vera to reference devices by an arbitrary user assigned name instead of the vera assigned device ID’s. For example, you have:
Device type
12 On/Off switch
34 Dimmer
56 MIMOLite
You would have:
Device Alias Type
12 LivingRoomSwitchA On/Off switch
34 KitchenIsland Dimmer
56 GarageDoor1 MIMOLite
It would be nice to have a way to map an alias to these ID’s so that they are easier to manage. Then, instead of using the device ID’s in LUUP, you could use the alias.
Now, I know you could edit the LUUP Startup area and define some variables as static devices there for use, but the average user probably won’t know how or want to mess with this. Something like:
gLivingRoomLight = 12
gKitchenDimmer = 34
gGarageSwtich = 54
Then reference them in your LUUP code, but a way to do this in the GUI and have the Vera do the mappings of IDs to Aliases would help better for something like this. Plus, when you kill the device, the alias will go away with it. Might create hell when the system can’t find an alias associated with a now deleted plugin, but I guess you could always make it give an alert for that in the status area and log.
So, if this was implemented at the GUI level, instead of what you have now (without static defines elsewhere):
local keyPad = luup.variable_get(RNET_SID, "KeyPad", 82)
You would have:
local keyPad = luup.variable_get(RNET_SID, "KeyPad", LivingRoomKeyPad)
Then, if you had a piece of code that was exported, say from the PL series of plugins, or anything else, you could just replace the aliases instead of trying to hunt down device ID’s. Or, if the system allowed multiple aliases to be defined for a device, you could just define another alias (at the risk of adding more complexity and making trouble for yourself later).
Of course, there would have to be some standard defined for device naming if things were ever exported, making it easier to identify a device, such as a light switch from a dimmer (names like s443 and d45 would not make any sense unless you knew what they were)
Or this could just make the Vera too complex, 100 % unstable and just a glorified (and expensive) paperweight.
(It’s just a thought).