openLuup: SmartSwitch plugin
-
Requirement from @DesT is that instead of using the device numbers to specify linked devices, it would be nice to be able to use names. That way, a change requiring a change of device (perhaps new hardware, or something now running locally, rather than bridged from elsewhere) could be automatic, if the device name was preserved.
The original author (@hugheaves, that's Hugh Eaves) had a somewhat idiosyncratic coding style, and I've tried to preserve that whilst making minimal changes. In brief:
- a new variable
UseSwitchNames
should be set to 1 to switch to names mode - a new variable
SwitchNames
automatically maintains a list of the device names - the existing
SwitchIds
variable is watched to keep theSwitchNames
list synchronised
The last change above is required because the
SwitchIds
variable is actually changed by JavaScript code from the device Settings tabs, rather than from an action within the Lua code.I've created my own fork of the original Hugh Eaves repository, added an openLuup branch with the changes by Vosmont (not available in one of his GitHub repositories), and then layered my own change on top, to preserve the change history for future reference:
The single changed file
L_SmartSwitch_core.lua
is available in raw form here:Feel free to report any issues here.
AK
- a new variable
-
Yes, just that file.
It will use your current config and create the necessary variables. You just have to set the
UseSwitchNames
variable to 1. -
Yes, that’s not a problem, and nothing to do with this plugin change.
Go buy some Shellies...!
-
That wasn’t on the list!
-
I’ll take another look.
-
If you feel like linking it to the store I'll update the store list: List of plugins available at the Alternative App Store.
We should round up as many old plugins that we find and get them into GitHub and the store (as long as they are not proprietary). eg I would like to see the Sonos app in the store (it's in GitHub) but togglebits seems to be busy on some other new fangled plugin.
-
I can't believe I never did it... but it's done now!
@akbooer On a related note, what do we put in for the ID if we have a plugin that never was in the Vera App Marketplace and has no Vera plugin ID?
-
@toggledbits said in openLuup: SmartSwitch plugin:
@akbooer On a related note, what...
Something unique, not numeric, so SmartSwitch, for example.
-
-
In the device list we have:
Is it easy to add "Zone 10" just under "Mode: Off" ?
Zone 10 is coming from the settings "tab"This way, it will be easy to see which devices trigger the smartswitch without having to do them 1 by 1 and check in the Settings tab...
-
The Settings tab is all JavaScript stuff, not Lua. Although the device panel data is stored in a device variable (and set in Lua) I'm not sure where to find the relevant information. I'll have to look more closely.
-
@dest said in openLuup: SmartSwitch plugin:
I never use multiple devices
OK, you'll find an updated Lua file, v2.0.3, here:
It lists the name of the first trigger device. In the event that you do use more than one trigger, there will be an ellipsis "..." added after the first name (to give at least some visual indication that something is going on.)
I've done nothing to guard against the line overflowing or wrapping because of a long name.
1/27