HTTP luup requests

Hello Comunity
I’m using Vera for several years now.
And i do this with no major problems.

I wrote an Android APP what is running on several tablets and also my smartphone.
Tyis app comunicates with Vera by http luup requests like this one:
[b]http://ipaddress:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1[/b]
This runs realy smoth.
Now, i’m planing to set my Vera to factory default and to set up my whole network.
Here i see a big problem.
All my devices, up to now about 30 of them, are receiving new device IDs.
This means, i have to adapt also all the strings in my Android APP.
Yes, of corse, i have to do this once. But, please, only one time.
My question now is as follows:
Is there a way to send a similar HTTP string like the one above, but with not the “DeviceNum=xx” but with the Device Name. This name is created by me in a very clean manner so i do have no doubble names and these names are never changed.
I would be very happy to see any help from someone.
Kindest regards, Paul

You would have to implement your own request handler in LUA and do the mapping there.
Instead of caling the action directly … you would call your handler. In your handler you would map the device name to deviceID than call luup.call_action directly.

See LUATest for an example handler setup in LUA.

There are tantalizing hints on the Luup extensions page that instead of a device’s number, you can use its UUID. Every device seems to have one of these: take a look on the Advanced tab for the local_udn special variable. And the string appears to be editable, so perhaps if you take a note of them all now, you can restore the same strings after you reset your Vera.

You’ll still have to change your Android app once, to use the UUID instead of the device number, but if this works you won’t have to do it again.

Hello Richard
Thanks for your hints. Seems, i have to learn a new prog-language again.
I just installed the LuaTest and started to play with it.
But, until now, i did not find anything about request handler.
Only handler i found was here: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_register_handler
So…i have to learn quick…
I will see what i can find.

Hello Futzle.
Also thanks for your answer.
Might be helpfull. But i use some old Duewi actuators and even if i can edit the local_udn in Vera, seems these units seems don’t store them.

regards, Paul

I just installed the LuaTest and started to play with it. But, until now, i did not find anything about request handler.

LuaTest is a request handler. Richard was suggesting you could look at the code to see one way of implementing it.

Only handler i found was here: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_register_handler

This is the function call that is used to register a request handler. Then when an http request is received, Vera routes it to the registered handler.

Hi people
Now, i got the initial kick.
Next step is to read and learn and thinking…
Thanks so far.
If i need any more help, i’d like to come back.
Regards, Paul