Plugin - Variable Container

Plugin has been unpublished by me. I don’t want to continue to work for such a company.

I created myself a plugin which creates a device with five string variables, and five string variables to name these variables. These variables can be read and written by luup code or in the device settings tab (advanced). The value of this ten variables is shown in the dashboard too.

As an example the plugin can be used to transfer variables in between scenes or as a configuration window to centralize settings for luup scenes or it could be used to show values of different devices in the dashboard. I use it to see directly in the UI which scene was last used and at what time, when doors were opened etc. I use it for luup logic too, in example I have a variable for one of my rooms which ?always? knows if lights were last turned on by motion(1) or manually(0), the scene which should turn of lights automatically (only when they were turned on automatically) therefore can check if lights were manually or automatically turned on. Possibilities are endless, anything is possible.

To integrate with scenes luup code has to be used at the moment (Variables 1-5):

[code]luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“VariableName1”,“Variable1”,lul_device)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,“value”,lul_device)

luup.variable_get(“urn:upnp-org:serviceId:VContainer1”,“VariableName2”, lul_device)
luup.variable_get(“urn:upnp-org:serviceId:VContainer1”,“Variable2”, lul_device)
[/code]

Setting Values by http: http://forum.micasaverde.com/index.php/topic,9022.msg86354.html#msg86354

A function makes getting and setting variables much easier: http://forum.micasaverde.com/index.php/topic,9022.msg82836.html#msg82836

Installation:

This works on UI4 and UI5, but on UI4 has to be installed manually (http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins).

Through the App Store (UI5):
http://apps.mios.com/plugin.php?id=1458

Manually (UI4):
? Download the four files from the links below (newest version is recommended).
? Upload them to your vera (Apps=>Develop Apps=>Luup Files)
? Create a Device (Apps=>Develop Apps=>Create Device) and set ?D_VContainer.xml? as the Upnp Device Filename.
? Restart Lua Engine

Version History:

VERSION 1.0
http://apps.mios.com/download-plugin.php?PK_Version=3018

VERSION 1.1
http://forum.micasaverde.com/index.php/topic,9022.msg60420.html#msg60420

VERSION 1.2
http://forum.micasaverde.com/index.php/topic,9022.msg61402.html#msg61402

VERSION 1.3
http://forum.micasaverde.com/index.php/topic,9022.msg62472.html#msg62472

VERSION 1.4
http://forum.micasaverde.com/index.php/topic,9022.msg76193.html#msg76193

VERSION 1.5
http://forum.micasaverde.com/index.php/topic,9022.msg78844.html#msg78844

VERSION 1.6
http://forum.micasaverde.com/index.php?topic=9022.msg92542#msg92542

VERSION 1.7
http://forum.micasaverde.com/index.php/topic,9022.msg103071.html#msg103071

VERSION 1.8
http://forum.micasaverde.com/index.php/topic,9022.msg138136.html#msg138136

VERSION 1.9
http://forum.micasaverde.com/index.php/topic,9022.msg211805.html#msg211805

…some screenshots…

wow, the approval on apps.miso.com only took 13 hours (!!!):

http://apps.mios.com/plugin.php?id=1458

Thanks!

This is exactly what I have been needing for a plugin I’m working on.

Chixxi,

Just a few minutes ago I posted a new topic asking if anyone has done this, and then, wow, I find this. I just downloaded and will start playing with it tonight. If it works like I hope, you will have saved me a ton of time and effort! I’ll let you know how I make out and if I make any additional changes.

Update: THIS IS EXCELLENT! MCV should build this into the next major upgrade. Wish list: 1) Java or Ajax updates on the variables, so the page changes dynamically as the variables change, 2) 5 more Name/Value pairs, 3) Display Tab1 on dashboard with some text that says “Watching X variables”, where x= total of all variables that do not have the default name, hence, are being ‘watched’.

Great work, and thanks again for posting.

kartcon

I am glad somebody can use it. Its quiet a simple thing but possibilities are endless.

Thanks for the wishlist. I am working on the next version, but I also have some other plugins which I am working on…

Chixxi,

Thanks for implementing this… It is so obvious that the VERA UIx needed something like this for support of Scenes, that i think it has simply been overlooked.

I was able to install from app.mios.com onto UI5/Vera2 host and that worked great…

I did install from apps.mios.com on UI4 VERA2 and it seemed to install, but name on plugin was incorrect (testsilviu) as well as name on Device (_Tv) were incorrect. Also variables did not show up for the device that was created by plugin. So i removed it. I will download your source code and see if installing it manually helps.

I will post my results on UI4 installation at later date

Thanks again for “good idea” and implementation thereof.

Kind Regards

I think apps.mios.com is not compatible with UI4. And since I didn’t get my Vera3 yet I can not test on UI4, I need UI5 for the Aeon Labs Minimote on my Vera2. Did you have any success with manual installation on UI4?

I am working on the javascript version. Expecting a basic update in 1-2 weeks.

@kartcon: If you need more variables just create a second device, then you get five more. ::slight_smile:

Chixxi,

Since this was so useful to me I decided to update your code to add 5 more variables. I also wanted to be able to know which scenes had run recently so I added some code to do that as well. The last run scene goes into Variable 6 and any current data in Variables 7 - 10 get pushed down the list eventually pushing #10 off the list. This has worked extremely well for me and it allows me to confirm that silent scenes (not visually obvious) ran as planned. I’m still working on the code to update the dashboard which says “Watching x variables”. Currently it is a static number entered in the advanced tab.

To reduce to code overhead, I wrote a function that gets added to Startup Lus tab, and a small calling routine that updated the variables. All the code and updated files included below.

Thanks again for a great tool - and the motivation to start learning how to program my Vera make it do what I want.

Here’s a screenshot from this morning.
[url=http://www.quartermidgets.org/temp/VarConScreenShot.gif]http://www.quartermidgets.org/temp/VarConScreenShot.gif[/url]

Place this in the Startup Lua tab:

function log_last_scene (last_scene) local lul_Var9 = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable9", 34) luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable10",lul_Var9,34) local lul_Var8 = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable8", 34) luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable9",lul_Var8,34) local lul_Var7 = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable7", 34) luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable8",lul_Var7,34) local lul_Var6 = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable6", 34) luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable7",lul_Var6,34) luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable6",last_scene,34) end

Next add this to the Luup tab of the Scene you want to log:

log_last_scene("Your_Scene_Name")

Lastly, update the 4 files:
D_VarCon.json, D_VarCon.xml, I_VarCon.xml & S_VarCon.xml

Hope someone can use this.

kartcon

very very nice! is it ok if I implement some of your ideas (and code) in the next update for apps.mios.com?

It would be kind of nice to publish your “Last Scene Run Counter” as a separate plugin…

Going to take a closer look sometime on the weekend.

Chixxi,

Yes, please do. Feel free to use any of my code in your development process. The ultimate goal is a better product for everyone.
BTW, I’m using a Vera 2 on UI4 (build 1.1.1362) and it works just fine.

kartcon

VERSION 1.1

I uploaded version 1.1 of the plugin VariableContainer to apps.mios.com.

For UI4 / manual installation download files here and install as described in the first post of this thread:
http://apps.mios.com/download-plugin.php?PK_Version=3178

This update includes a new tab based on java-script to edit the variables. See screenshot attached.

@chixxi

I couldn’t approve the version you submitted because the plugin didn’t install correctly. There is a bug in the release version of the firmware: it cannot install uncompressed files. This has been fixed in the latest beta.

Until then, I modified your plugin to use a web based icon, and published this version.

  • Unfortunately the current page layout cannot handle long version comments properly, you’ll see what I’m talking about when you visit the Version page. :slight_smile: We’ll fix this by the end of the week.

WOW, thank you for the quick fix! I love problems which resolve themselves automatically ;D

I must have done something wrong when publishing since I was aware of that problem and didn’t want to release a version with custom icon. But thank you very very much again!

By the way, I have two wishes for apps.mios.com: 1. Please add a delete button to the versions. 2. Add something like “Downloaded XXXXX times” in the app store for each plugin.

And I am glad to hear about some nice fixes in the next beta…

VERSION 1.2

I uploaded version 1.2 of the plugin VariableContainer to apps.mios.com.

For UI5 let the plugin automatically be installed from apps.mios.com:
MiOS Apps

For UI4 / manual installation download files here and install as described in the first post of this thread:
http://apps.mios.com/download-plugin.php?PK_Version=3438

This update includes a new save-button which allows changing the variables on the flow without having to restart the luup engine on each change.

Hello,

I would like to use this plugin and am a newbie. I have UI version 1.1.1362. I have tried to “download” the files from the links you gave (I guess I need to save the source to the filenames indicated and upload them?). I follow the instructions to upload the luup files and create a new device. The device shows up but without any variables. So, I think it is not getting installed correctly?

Any help would be much appreciated. I don’t know what I am doing wrong!!

Thanks and cheers,

Hello again,

Do you have screen shots for UI4? I do not see any preinstalled variables. Under the tab “Advanced” I see “Variables” and I can enter “New Service”, “New Variable” and “New Value” but I don’t think this is what is supposed according to what the other posts say. Under “Device Options” I have “N/A”…

Any help would be much appreciated as I have a thermostat that never seems to get updated in VERA.

Many thanks,

@chixxie
I recommend adding the “Position” tag to all the tabs, otherwise not all the tabs will appear on UI4. I attached the updated Json. The first tag should have “Position”: “0”.

hmm, I removed those because I thought they were not used any more, at least they don’t have an effect on the tab order. I will do an update today, thanks for the input…

VERSION 1.3

I uploaded version 1.3 of the plugin VariableContainer to apps.mios.com.

For UI5 let the plugin automatically be installed from apps.mios.com:
MiOS Apps

For UI4 / manual installation download files here and install as described in the first post of this thread:
http://apps.mios.com/download-plugin.php?PK_Version=3508

This update includes a fix to show all tabs in UI4.