Remote Http Request

I found a post that explained how to make a http request to activate a virtual switch from inside the LAN. I want to do this remotely. I would prefer to use the safety and security of cp.mios.com, but have no idea how to use my login to accomplish this. Is this the best approach and if so, how do I do it?

Thanks,

Tim

This is a sample of the request that should work within the LAN

http://veraip:3480/data_request?id=lu_action&output_format=json&serviceId=urn:upnp-org:serviceId:VSwitch1&DeviceNum=123&action=SetTarget&newTargetValue=0

You are basically writing a very restricted remote-access controller when you do this. The magic is described here: http://wiki.micasaverde.com/index.php/Luup_Secure_Plugins#Step_by_step_process_of_provisioning_an_external_app_like_a_mobile_phone

Look for fwd_server on the page.

After digging through the forum I have come up with the following http request to try and flip a virtual switch. I am not getting a invalid user/ pass error, but the device status doesn’t change. Any ideas?

https://fwd1.mios.com////data_request?id=lu_action&output_format=json&serviceId=urn:micasaverde-com:serviceId:VSwiitch1&DeviceNum=230&action=SetTarget&newTargetValue=0

[quote=“timholmesjr, post:3, topic:173915”]After digging through the forum I have come up with the following http request to try and flip a virtual switch. I am not getting a invalid user/ pass error, but the device status doesn’t change. Any ideas?

https://fwd1.mios.com////data_request?id=lu_action&output_format=json&serviceId=urn:micasaverde-com:serviceId:VSwiitch1&DeviceNum=230&action=SetTarget&newTargetValue=0[/quote]

It will depend on which forward server your mios user is actually using. For MCV it could be fwd1.mios.com, fwd2, fwd3, or fwd4.mios.com/

You can get the active forward server from http://sta1.mios.com/locator.php?username=

If you want json formatted results use locator_json.php

Is that riight?

No,“VSwiitch1” wasn’t right. I corrected that and changed the urn:micasaverde-com to urn:upnp-org and it worked.

Can you post the URL sample you successfully used to flip a Vswitch?

Update:

http://192.168.1.xx:3480/data_request?id=lu_action&output_format=json&serviceId=urn:upnp-org:serviceId:VSwitch1&DeviceNum=56&action=SetTarget&newTargetValue=0

I’m trying to fetch a value from a VSwitch1… (Virtual Switch Plugin) but it gives me an empty response…

data_request?id=variableget&DeviceNum=90&serviceId=urn:micasaverde-com:serviceId:VSwitch1&Variable=Status

It does work for other devices…

Any ideas?

data_request?id=variableget&DeviceNum=90&serviceId=urn:upnp-org:serviceId:VSwitch1&Variable=Status ?

Is there a variable within the Vera which contains on which fwd-server the vera is?
I wanted to use php and use the http://sta1.mios.com/locator.php?username= URL but my hosting is blocking fopen() so i cant use that one.
If there is no variable available then i guess im stuck with luup.inet.wget :wink: and send the result to my php file for processing

It is only available in the user_data2. Which is the configuration of the vera unit. You would have to parse the data which is in json format.

  • Garrett

Then i would be easier for me to use the inet.wget and parse the fwd address out of it.
Im notice also that im running against the limits of a vera2 and (lots of automation scripts running on interval) and that im thinking of upgrading to a vera3 of a veralight as the cpu is a good upgrade and the nand is also dubbled the only difference between the 2 is the RAM (i dont use the other features that the vera3 offers)