Say I created a scene with the ui that dims switch 6 to 30% when device 5 is on. I am hoping to find a way to view that scene as code, such as (borrowed from wiki):
local lul_tmp = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 5)
if (lul_tmp == "1") then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = "30"}, 6)
end
This would be extremely helpful for those just starting to learn lua and wanting to make plugins.
Right now I’m trying to find code that checks a light’s change of status (when a light turns on) and the only example I see on wiki.micasaverde.com/index.php/Luup_Scenes_Events is one that checks the status (when a light IS on).
I know it is possible using the information here http://wiki.micasaverde.com/index.php/Luup_Lua_extensions but for those without any lua/programming background this is still Greek and would take a good investment of time to understand how to use it. Likewise it is very time consuming to install apps (not all apps are on code.mios.com), search through the code, eventually find an app that has a useful section, understand it, modify it, then implement it. Having a poor man’s code/snippet generator by creating/viewing scenes would be a lot faster for a novice looking to write something simple or modify an existing plugin.
That’s not it … that stuff for the gui …
It will be under the scenes array. Make your scene name something weird and then you can search for it in the JSON or XML file … It will be in a substructure of scenes.
You are seeing gui information on how to setup the UI to ask for a value.
Keep looking you will find it …
The information is stored in a manner to allow Vera to restart and not loose data. It’s not really meant to be read by a person!
[hr]
The only other way I know how to access is from JavaScript embedded in the Vera Web User Interface. But it’s much more complicated to get it setup. First you would have to understand how to extend the Vera Web Interface. That’s a class in itself!
Try entering the details below into your browser. More details can be found here and here and here
Option 1
http://Vera_IP:3480/data_request?id=lu_invoke
This will provide a html drill down of Controls, services and actions available for devices on your system.
Option 2
http://Vera_IP:3480/data_request?id=scene&action=list&scene=Scene_Number
This will display the details for a given scene.
Option 3
http://Vera_IP:3480/data_request?id=user_data&output_format=xml
or
http://Vera_IP/port_3480/data_request?id=user_data&output_format=xml
Search for “”
List all details and serach are review as required.
Brientim’s method works for me. I get ERROR when the scene number does not exist, which I suspect is the problem you’re having. Under Automation, select the wrench for the desired scene. At the top of the page, you’ll see “Edit scene no. #”. That’s the number you want to use.
I believe what you really want is not possible. The actual scene code will not be what you see posted in the forum written in lua/luup. The code for the scenes in vera will be written for how the Mios / luup engine can interpret it. It will not be written actual code forum like the following:
local lul_tmp = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 5)
if (lul_tmp == “1”) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “30”}, 6)
end
Thanks Garrett. That’s a shame. It would be an extremely useful tool for people like me. Right now it is costing me hours to create a very simple function (yes function) since I must hunt through multiple apps for a snippet that may work then debug through trial and error. It is incredibly inefficient.
BTW is there any way to pause the scrolling of the log? I’m accessing it through the browser. It speeds by so quick you miss the info. If you scroll up to review it just speeds back down. Is there any pause/break command? I find it frustrating and useless for debugging anything starting up. The only way I can view what occurs is sitting in wait like a sniper hoping to copy/paste the information elsewhere to read. Hopefully I’m missing something. Right now I am using 2 different programs and multiple steps just o see what the error message is.
kkl - I’m confident in the scene number and ip. I am running UI4 if that matters. If I access the data using the third method I can search through all of it and find this which I believe confirms the scene number is accurate.
[quote=“Shorty, post:11, topic:174057”]kkl - I’m confident in the scene number and ip. I am running UI4 if that matters. If I access the data using the third method I can search through all of it and find this which I believe confirms the scene number is accurate.
[/quote]
You're probably right that it's a UI4 difference. You might try port 49451 instead of 3480.
This scene has a lot off commands as you can expect from the scene name … in XML these are listed as actions. You can convert the first Action to luup code as follows:
Generically as:
luup.call_action('ValueOfService", "ValueOfAction", {"ArgumentName": "ArgumentValue"}, tonumber("Device"))
or for my first action:
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newLoadlevelTarget = "100", 14)
Best Home Automation shopping experience. Shop at Ezlo!