My Notes on remote access for UI6

Are you providing the token as a special header in your request? You must pass the token with your request via a header.

  • Garrett

[quote=“garrettwp, post:21, topic:181032”]Are you providing the token as a special header in your request? You must pass the token with your request via a header.

  • Garrett[/quote]

Thanks Garratt.

Yes. I’m providing the token as “MMSSession” header with the token as the value. I tried for fun to pass the MSSSession token from the relay server to the account server using the string with out “/devices” and this rightfully resulted in a “(401) Authorized” error.

There is a DIFFERENT session token for EACH server you talk too.

Your first request for ANY server should be to obtain the session token for that specific server.

Are you sure you are using the right Session token for the specific relay server.

Did you follow my notes to obtain the relay server ? Or did you hard code it ?

As I mentioned in my notes there are only two HARD CODED urls in the protocol …
the rest are derived from responses. (Actually there are 4, since each of these has an alternate with 11 as opposed to 12,
how to find alternates is also defined by the protocol).

The hard coded URLs are:
https://vera-us-oem-autha11.mios.com
https://vera-us-oem-authd11.mios.com

[quote=“RichardTSchaefer, post:23, topic:181032”]There is a DIFFERENT session token for EACH server you talk too.

Your first request for ANY server should be to obtain the session token for that specific server.

Are you sure you are using the right Session token for the specific relay server.

Did you follow my notes to obtain the relay server ? Or did you hard code it ?
…[/quote]

Yes, I did all those things right. Only thing I didn’t do correctt was to spell my username correctly before it was SHA1’ed. DUH!!! :-[

The good thing is that it all works perfectly now :slight_smile:

Thanks for much for your support. I literaly spend about a day tracking down that bug.

I am able to get all UI7 device info but problem for when i create scene does not able to create

I am use

  1. $url = “https://vera-us-oem-authd11.mios.com/autha/auth/username/$sUserName1?SHA1Password=$passwordSha&PK_Oem=1”;

  2. send realy request with id=scene&action=create

https://vera-us-oem relay41.mios.com/relay/relay/relay/device/35011801/session/0DD42F5FCF72EA43B0BE822C45A3A28E3B2608/port_3480/data_request?id=scene&action=create

with session token in header like
curl_setopt($ch, CURLOPT_HTTPHEADER, array(“MMSSession:$sessionToken”));

but not working

when i am print curl result just disply “Error” message

Does enybody has .NET Code covering logon to UI7 and some samples for sending requests?

thanks

:: Paul

[quote=“wessiack, post:26, topic:181032”]Does enybody has .NET Code covering logon to UI7 and some samples for sending requests?

thanks

:: Paul[/quote]

Hi Paul,

I’ve implemented .NET authentication for UI7 (i.e. MMS), but it is part of a larger project which is created as an extension of this project here: http://veradotnet.codeplex.com/.

The project on Codeplex does however not include the MMS authentication part so I extended that part myself.

Anyhow, I’ve tried to pull out the pieces that you’re asking for in the attached. I hope you can use it. If not please ping me directly here on the forum and I’ll see if I can assist you to sort it out.

Good luck and let me know how it goes. :slight_smile:

[quote=“RichardTSchaefer, post:1, topic:181032”]I spent a lot of time like other to figure out all of the details of connecting to the UI6+ MCV remote access servers.
Attached are my notes for finally succeeding. I hope you find them useful.

There is some assumption that you already know about UI5 access and are familiar with the MCV requests you can make of your Vera.[/quote]

Thanks, Richard! This is excellent and I’ve managed to handle remote access to my UI7 box. However, I can’t get the locator URL https://us-authd11.mios.com/locator/locator/locator to work. I want to be able to determine if I should connect locally or remotely; if I use the remote access, I get an internal IP address. With the older setup, if I hit the MCV server, I was able to tell if I should use the internal or remote method.

Has anyone managed to figure out the correct/best way to determine if we should use the relay server or the internal IP address?

Thanks.

If you are developing an app for a device platform, check the changes on the connection of the device and test if you can reach your Vera unit on the local network. If you can’t proceed using the remote servers .

  • Garrett

If I am on Wifi I will check local access first … then fail over to remote access.
It makes no sense to try Local access if your are NOT on Wifi.

I should have been more descriptive, as Richard stated only check local access if on WiFi.

  • Garrett

Thanks for the replies; I was hoping to have a better way than to make a local call (if on WiFi), wait for it to fail, and then use the relay server.

A local connection will fail quickly if Vera is not available.

Re: UI6 and HTTPS access (remote) Problems
? Reply #9 on: August 05, 2014, 03:32:45 am ?
I have two accounts one is running ui5 and other is ui6.

Create scene works perfect with ui5. I am using same data format to request for a UI6 unit.

I am sending the json string as a POST parameter because the string is very long.

Every thing is work fine with UI5. But dont know what is the issue with UI6.

Following are the details for your reference

URL :

https://vera-us-oem-relay12.mios.com/relay/relay/relay/device/35020991/port_3480/data_request?id=scene&action=create

POST data

{“scene_name”:“if master bed is off then 2 thrmostat is heat on”,“name”:“if master bed is off then 2 thrmostat is heat on”,“groups”:[{“delay”:0,“actions”:[{“device”:“11”,“service”:“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“action”:“SetModeTarget”,“arguments”:[{“name”:“NewModeTarget”,“value”:“HeatOn”}]}]}],“triggers”:[{“name”:“testing tiggers”,“enabled”:1,“device”:“9”,“template”:“1”,“arguments”:[{“id”:1,“value”:“Off”}]}],“timers”:[],“lua”:""}

we post data using curl with MMSSession token

$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(“MMSSession:$sessionToken”));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60); //timeout in seconds
if($aPostData != null)
{
$fields_string = ‘’;
foreach($aPostData as $key=>$value) { $fields_string .= $key.’=’.$value.’&’; }
$fields_string = rtrim($fields_string, ‘&’);
curl_setopt($ch,CURLOPT_POST, count($aPostData));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//print_r(count($aPostData));
//print_r($aPostData);

  }
  
  $result = curl_exec($ch);

if i am print this $result varible then it’s show ‘ERROR’

Please advice

Sorry I do not have a clue …
But you might want to verify every little detail.

i.e.

  1. Are you sure the Token is correct … i.e. can you successfully make a relay call before/after this failure.
  2. Can you do a Simple Scene Create with GET method (Small string)
  3. Can you do a Simple Scene Create with PUT method (Same small string)

Also can you do this locally.

  • Garrett

[quote=“jasperhb, post:27, topic:181032”]Hi Paul,

I’ve implemented .NET authentication for UI7 (i.e. MMS), but it is part of a larger project which is created as an extension of this project here: http://veradotnet.codeplex.com/.

The project on Codeplex does however not include the MMS authentication part so I extended that part myself.

Anyhow, I’ve tried to pull out the pieces that you’re asking for in the attached. I hope you can use it. If not please ping me directly here on the forum and I’ll see if I can assist you to sort it out.

Good luck and let me know how it goes. :-)[/quote]

Hi jasperhb thanks so much for that, i’m also trying to get MMS auth working through veradotnet. I added your code parts but there is still a class type missing ‘MiosRequestHeader’

ignore my last post - i got it working, thanks again

Great. I’m happy that it was helpful. Took me a couple of days to do it myself.

i have created a bunch of helper functions to talk to UI7 from php, so far i implemented pretty much everything i found in the wiki.
If there is interest in that, i can do some code cleanup, documentation and publish it on github.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules