Turn on lights via http url??

Is it possible to create a bookmark with a url that would turn on light switch via http?

I ask because when I am home, I absolutely hate fumbling into the interface to do a simple task. I just want to make an icon on my iPhone that would turn on the lights.

Possible?

You can use this to turn a binary light on:

Remotely:

https://fwd2.mios.com/john/tokyo/10266/data_request?id=lu_action&DeviceNum=&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1

You will need to know what forward server you are on e.g. fwd1 or fwd2 for UI4 firmware.

change the following:

john = your mios username
tokyo = your mios password
10266 = your vera unit number
= change this to the device number of the light you want to turn on
TargetValue=1 1 = on 0 = off

For local access:

http://:3480/data_request?id=lu_action&DeviceNum=&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1

Change the following:

= the ip address of vera
= change this to the device number of the light you want to turn on
TargetValue=1 1 = on 0 = off

To toggle a device on/off depending on their state:

remotely:

https://fwd2.mios.com/john/tokyo/10266/data_request?id=lu_action&output_format=xml&DeviceNum=&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=ToggleState

john = your mios username
tokyo = your mios password
10266 = your vera unit number
= change this to the device number of the light you want to turn on

local:

http://:3480/data_request?id=lu_action&output_format=xml&DeviceNum=&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=ToggleState

Change the following:

= the ip address of vera
= the device to change the toggle state

  • Garrett

Thanks Garrett! This would be handy when it comes to creating custom UI controls!

What if I am port forwarding my Vera? Is is possible to do this?
http://my.static.ip:port/data_request?id=lu_action&DeviceNum=3&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1

I realize that it says ā€œFile not found.ā€ is the data_request in a different folder?

If you forward an external port to Veraā€™s port 3480, it should work.

<Insert usual warning about port forwarding here. Iā€™d go through the cp.mios.com tunnel as indicated by @garrettwp, or your own VPN, etc.>

Not working for me. Did this access get discontinued between 2011 and now?

I just tried curl ā€˜https://fwd2.mios.com/UnRealVera1/redacted/50017623/data_request?id=lu_action&DeviceNum=14&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1ā€™ and it failed with ā€œInvalid user/pass.ā€

I happen to have two veras and each with their own separate usernames and passwords, and they both failed the same way. Passwords were copied and pasted out of lastpass so i donā€™t think I got those wrong.

Does this API require urlencoding of passwords, or forbid certain characters be in passwords? One of the passwords had a lot of punctuation, the other just underscore, which I tried replacing with %5f to no avail.

My unit number looks pretty far off from yours, so maybe I have that wrong. If I got the unit number wrong, should I expect an error message like ā€œyouā€™re not authorized to controll that unitā€ or will it tell me ā€œInvalid user/pass.ā€, which would technically be false.

Interesting I wasnā€™t even aware you could send HTTP commands to Vera without port forwarding.

I wonder if the new Ezlo Api has this ability also.

Are you wanting to send the command remotely from outside of your home network?

Or send it locally from within your home network?

You canā€™t that was removed
http://wiki.micasaverde.com/index.php/Luup_Requests#Accessing_Vera_remotely_through_the_MiOS_servers

I see the same.

fwdX.mios.com is the old Mios UI5 portal gateway / relays, that no longer works, as @ElCid just found a link for in the Wiki.

Iā€™m wanting to put a little bookmarklet in my browser that will work no matter what network Iā€™m on or where I physically am. Iā€™d rather not think about networks when I just want to turn on a light.

Is the only way for me to (securely) do that, for me to write my own API server, host it on the same lan as my vera, and forward a port to it from outside? canā€™t be.

The android app works securely from any network, so how does it do that? What ever mechanism the app uses, is what I need my bookmark to use.

The android app goes through ezloā€™s server.

To set a request to vera over the web you will have to do one of these things

  1. forward the port from the router to the local ip of the vera, not the most secure way.
  2. set up a vpn tunnel from your phone to your home lan, secure.
  3. use an app like tasker or automate, you would need an android device at home all the time. this acts as a server, you can then send cloud messages from your phone, via browser bookmarks, to the android device at home. This then converts the cloud message to a http request and forwards it to vera.(this is the method i use)

hmm. Well, i appreciate the options, but it would be easier to walk through the dark house using my phoneā€™s flashlight than set up all that. I hate regressions. Taking that functionality away reminds of of the Google/Nest thermostat saga. It kind of defies the idea of home automation being a helpful thing vs. a controlled sales channel.

I donā€™t understand why I canā€™t use api-cloud.ezlo.com or cloud.ezlo.com like the app does. I wonder if thereā€™s some problem with ezloā€™s protocol that Ezlo doesnā€™t want folks to find out about so they try to keep people out of it, but thatā€™s not what https is for.

I imagine I can probably put an organizational root CA cert on my phone and MITM my own connection to see how it works, but thatā€™s also an awful lot of work.

While you have your phone in your hand for the flashlight you could always use the Vera app to turn the lights on? On the other hand true home automation isnā€™t clicking a bookmark in a browser, true home automation wouldnā€™t let you wander in the dark in the first place :wink:

3 Likes

Bit easier using Imperihome app on Android you can create a home screen widget to directly run a Vera scene.

Ezlo should look at adding that functionality for their Vera / Mios app.

I agree. For whatā€™s not automated, I find voice control a better choice over my phone. I rarely use it.

I have a couple of shortcuts for the gates for when Iā€™m out (biking, walking) - or for when I used to. I had to write a relay in order to do it. Their solution would probably be cumbersome, involving expiring tokens and such. Itā€™s not easy to build secure features for the masses.

Using Automate was easy, All cloud messages go through google firebase, and are https. I can encrypt and decrypt my messages so google does not see the message. I can also just press a sequence of hardware key on phone and fire of a command to vera. Take a look if you need to see examples of server i can give you a link to an automate flow.

Actually same for me, I raise my hand and tell my watch what I want to do/happen/know. Itā€™s not Vera native but thatā€™s how our family do things overriding automations :slightly_smiling_face: