Get variable....HTTP working, just one more question!

http://ip:3480/data_request?id=variableget&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status

Can someone help me break this down? I need to use it for fetching the lighting levels of dimmers…will this work?
Thanks
Tim Alls
AllSeas Yachts

Service is [tt]urn:upnp-org:serviceId:Dimming1[/tt], variable is [tt]LoadLevelTarget[/tt] or [tt]LoadLevelStatus[/tt].

2.2.1. LoadLevelTarget Value of the desired load level, LoadLevelStatus is actual value of dimmer output. Dimmer may take time to ramp or jump to the target level so LoadLevelTarget may not equal LoadLevelStatus until the dimmer reaches the desired state. Can be any value between 0 (off) and 100 (full on). Also, see SetLoadLevelTarget().

2.2.2. LoadLevelStatus
Current dimmer output level. Can be any value between 0 (off) and 100 (full on). This value may change multiple times during the transition from the current state to the LoadLevelTarget value. The dimmer should only send the evented update when LoadLevelStatus is equal to LoadLevelTarget, but a control point may query this value during the time the dimmer is transitioning to LoadLevelTarget

Hi Tim,

Searching around the documentation and forum postings there are a dozen different misspellings of requests like you are trying to master. Programmers r unfortenitly notorus bad spelerz and Linux is unforgiving - especially with capitalization. Add to that the typical response from the Vera for any mistake is simply a blank screen…

I assume you’ve read http://wiki.micasaverde.com/index.php/Luup_Requests since your posted request contains the same error they give in the example. I also assume that page is simply out-of-date with the latest Vera firmware - so don’t take it as bible, but it’s a good source of what can be done - with corrections. :-X

Here’s the request that works for me, assuming you can add the http part yourself; split into meaningful lines but you will of course make it one long string:

data_request?id=lu_variableget
&DeviceNum=6
&serviceId=urn:upnp-org:serviceId:Dimming1
&Variable=LoadLevelStatus

Get every character right in the request and you will get a character(s) back that is the variable. If you use the Windows tool I sent you - you can see the full XML file and then simply copy-and-paste the data so there’s no misssspelins.

hope that helps!
bob

Thanks Flyboybob,
Is it to much to ask when giving documentation to use parenthesis around the variables and explain the sentence structure? No wonder I have been using WireShark more than the Wiki!
Regards
Tim Alls
AllSeas Yachts

Tim,

Let us know if the code I gave you works ok for you, plus any other good things you can do with it. In a search of these forums I find too many postings of problems and not enough postings of the actual solution that worked!

With the Windows program I gave you you should be able to get details on any variables you need to monitor from the xml and verify them in the program boxes - let us know how that works out for you too please by posting here.

I’m working on a more sophisticated app to replace the “dashboard” for myself - the dashboard is just way too limited and buggy for a product with so much potential. IMHO.

bob

variableget is the correct form, lu_variableget is not supported anymore, so the Wiki is correct. What is missing from the Wiki description is that you can use the UDN instead of the DeviceNum. I will update the Wiki when I find the time.

That’s a standard HTTP request which means that on the left of the equal sign is the parameter name and on the right is the value, though I agree that not everyone is familiar with this and a better structuring with explanations is a good idea.

Thanks,
When I document our yachts it is with the attitude that a dummy will be reading it…in this case I am the Dummy!
Thanks
Tim Alls
AllSeas Yachts

The Wiki page notes that:
“id - the id of the request (prior to 15 Oct 2010 all requests had an lu_ in front, which is now optional)” although like the original poster my Vera does not respond unless the “lu_” is prepended to commands. With 159 characters in the command we are sending there are 159 ways to make the Vera totally ignore me, and only one way to get a response…

I was going to modify my posting above according to your post “mcvflorin” but since I only received my Vera about 2 months ago (brand new from MCV) I am guessing there are a lot of units out there which will require the “lu_” to make this work, and besides your Wiki says it is “optional” anyway.

If you’re going to edit the Wiki please change all text occurances of “serviceID”, which causes the Vera to say “error: no device/service/action”. The “D” must be lower case.

bob

Thanks for the information everyone! It works great now.
Ap15e…you had the IDs and Variable that I needed.
I am puzzled by the Service ID…where are all those goodies listed at?
Am I correct that using LUAA and other methods have small variations and that I should be using example just for HTTP?
Sorry to be bugging you all…I am still new at this!
FlyBoyBob, good to hear someone else is making their own interface…I agree, much potential, need a better interface.
Regards
Tim Alls
AllSeas Yachts

FlyBoyBob,
You were correct as well…I never thought about simply reading the XML file…they are all listed there. I can now read individual variables without having to Parse the whole file…much quicker! I needed this for my interface to show all the current lighting values as well as door sensors. Workin Great!
Thanks again,
Tim Alls
AllSeas Yachts

I am puzzled by the Service ID.....where are all those goodies listed at?

http://wiki.micasaverde.com/index.php/Luup_UPNP_Files (partly outdated, but nevertheless useful). Consult the XML files in use for the final word on UPnP services and variables (‘MiOS developers’ → ‘Luup files’ → ‘D_…xml’ ‘View’ ).

Am I correct that using LUAA and other methods have small variations and that I should be using example just for HTTP?

Yes, there are inconsistencies in the APIs (http://forum.micasaverde.com/index.php?topic=6141.0), but the UPnP services and the UPnP variables are consistent regardless of the API used (Luup, http, JavaScript, …).

Trust the device, service, and variables(etc) names from the XML file - the spelling and capitalization are what your machine expects, regardless of what Wiki’s or forum posts tell you.

Also you want to use the Example http request under “user_data” at http://wiki.micasaverde.com/index.php/Luup_Requests - although note that my machine likes “user_data2” better for god-knows-what reason. The XML dump you get back is a wealth of information about device status, scenes, rooms, jobs pending, all kinds of goodies. Note that IE7 will truncate the XML with an invalid “xml data error” which is actually just the fact that it can’t handle the file size. I use Visual Studio to display the XML.

It was invaluable when I had Luup code errors - it includes the code the way it is stored in the machine, not the way the dyslexic parkinsons-jittery web editor in the “dashboard” shows it! :-\

Hope that helps, too,
bob

Ok, all I need is more time and an endless supply of beer to keep me going!
The XML file is great…just copy and paste.
I think I am going to write a quick program that reads the entire XML file and defines the system in a spreadsheet for easy reference.
Everything seems to be fast and error free for now.
Thanks for helping me out…I am working on Visual Logic next…the code is easy but the user interface has to be as simple as an ATM machine and that’s hard!
Regards
Tim Alls
AllSeas Yachts

I’ve made a quick “data-parser” using an open source XML library.

I call the parser like this: ./get-var.sh -h hostname -d “device name” -a “attribute name” and it outputs the value of the attribute I want. I’ve made it case-insensitive to ease the pain of remembering if it was “Temp sensor” or “temp sensor” for instance, and it searches on the device names instead of the URN’s. Those are the same names you see in UI4, so to me it’s more intuitive.

The library is portable, so the package compiles for x86 and MIPSEL and thus runs on both desktop hardware and the vera box.

If you are interested, I can send you a copy

That’s great! I would love to take a look…that’s the way I learn.
FlyBoYBob wrote a similar application and it was very useful in getting me started. My latest code request only the individual device information and it make my life very easy plus it is very fast…much less data changing hands. My last challenge is Virtual Dummy Devices that can be used to store information. I have one working but its been a real challenge! I have a lot of information that I want to channel through Vera but and I don’t want to create more overhead for the tiny machine.
Regrards
Tim Alls
AllSeas Yachts