N00B question on variables

So I’m working on enhancing an existing plugin and the docs aren’t particularly helpful.
On this page: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#variable:_devices
I see that the devices collection contains the elements user and pass. These however no longer appear on the advanced page of a device when invoked.
So where has that setting moved to?
It seems that advanced_devices used to be called from the shared.js file to create the advanced tab. I can’t find that javascript file anywhere however. Can the advanced tab be modified at all?

The follow up question then would be, how do I add a tab to the set of sub tabs on the advanced page?
I’ve successfully added a main tab to my device. However on that I can’t figure out how to save the values and then what the syntax would be to reference them.

I’m totally fine if you want to tell me to RTFM but a link to that manual would be handy as the wiki seems grossly inaccurate and out of date.
Help? and thank you in advance!

This is just a guess but perhaps removing user and pass has to do with the attempts by Vera to improve security which has been mentioned in other posts on the forum.

As for info on the wiki being grossly inaccurate and out of date (and incomplete), I’ve made this comment on several posts of mine and it seems that everyone has come to accept the poor state of the wiki. I once received a Vera Customer Survey that I responded to. Part of my response was a comment about the lack of reliable documentation. I was surprised to receive a reply to my comment. Part of the reply from a person in marketing was:
“I have heard a lot of discussions internally lately about the lack of documentation. I THINK there’s an initiative to document better and pull it together in one place. I don’t think it’s going to be on the wiki though.”
That was 10 months ago. I’m a retired software engineer. For most software developers documentation is the bane of their existence. That of course does not mean it isn’t important. And it’s particularly important in this setting where a selling point of the product is the ability for the users to add functionality. All that being said, I don’t see any improvement showing up anywhere. And I cannot imagine a more appropriate place for this kind of documentation than a wiki.

Thanks for the reply tinman. I found out elsewhere that what I need to do is add the values to a custom tab and then populate them with a call to setvariable.
So be it.

I’ve created my new tab and added the fields to it but for the life of me I can’t figure out what to do to get it to save the value.
I’m using a variable control type. Clearly I need to add something to do the save but I’m not sure what that is.

Anyone know the key tid bit there? Is this a call to add an event handler? A command tag in the json? If someone can point me to an example that would be great. Everything I’ve seen adds a button that calls a function and that seems silly.

Hi,

There are more control types than just button. The control type input should do what you are looking for, but it does seem to need a button to store the value. See [url=http://wiki.micasaverde.com/index.php/Luup_plugin_tabs]http://wiki.micasaverde.com/index.php/Luup_plugin_tabs[/url]. For fancy things you will need to create a javascript definition.

Cheers Rene

This is an example form the Sonos plugin:

                {
                    "ControlType": "button",
                    "Label": {
                        "lang_tag": "cmd_setvol",
                        "text": "SayTTS"
                    },
                    "Display": {
                        "Top": 120,
                        "Left": 365,
                        "Width": 70
                    },
                    "Command": {
                        "Service": "urn:imperihome-com:serviceId:ImperiHomeDevice1",
                        "Action": "SayTTS",
                        "Parameters": [
                            {
                                "Name": "Text",
                                "ID": "TtsText"
                            },
                            {
                                "Name": "times",
                                "ID": "TtsTimes"
                            },
                            {
                                "Name": "Volume",
                                "ID": "TtsVolume"
                            }
                        ]
                    }
                },
                {
                    "ControlType": "input",
                    "Display": {
                        "Top": 120,
                        "Left": 165,
                        "Width": 150
                    },
                    "ID": "TtsText"
                },
                {
                    "ControlType": "input",
                    "Display": {
                        "Top": 145,
                        "Left": 165,
                        "Width": 50
                    },
                    "ID": "TtsTimes"
                },
                {
                    "ControlType": "input",
                    "Display": {
                        "Top": 170,
                        "Left": 165,
                        "Width": 50
                    },
                    "ID": "TtsVolume"
                }

What I’m trying to do is mimic the behavior of the existing settings. Go to any device and go to its advanced page. If you change a value there, you will see it says that the value is saved as soon as the input element loses focus. I suspect what I need to do it use my variable control but then use the JS API to add an event handler on loss of focus to do the call to setvariable. Just hoping I could find another plugin that already does this. It’s likely not hard but the JSON files are so undocumented it’s crazy.