Author Topic: My Notes on remote access for UI6  (Read 21109 times)

Offline bbredewold

  • Sr. Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
Re: My Notes on remote access for UI6
« Reply #15 on: July 08, 2014, 12:28:21 pm »
How did you find/get the PasswordSeed? Why is it static?

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10090
  • Karma: +762/-142
Re: My Notes on remote access for UI6
« Reply #16 on: July 08, 2014, 01:35:27 pm »
Because it's defined in the spec!!!!

Offline leolobato

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: My Notes on remote access for UI6
« Reply #17 on: July 16, 2014, 05:23:01 pm »
After their last update, has anything changed on authentication? I had this implemented and working but now it is returning:

Code: [Select]
WWW-Authenticate: MMSAuth error="invalid session"

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10090
  • Karma: +762/-142
Re: My Notes on remote access for UI6
« Reply #18 on: September 01, 2014, 12:32:28 pm »
NOTE: That the original notes need some changes as a result of MCV server changes:
     https://us-autha11.mios.com   gets changed to:  https://vera-us-oem-autha11.mios.com
     https://us-authd11.mios.com   gets changed to:  https://vera-us-oem-authd11.mios.com

Offline jasperhb

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +1/-0
Re: My Notes on remote access for UI6
« Reply #19 on: October 19, 2014, 09:24:31 am »
NOTE: That the original notes need some changes as a result of MCV server changes:
     https://us-autha11.mios.com   gets changed to:  https://vera-us-oem-autha11.mios.com
     https://us-authd11.mios.com   gets changed to:  https://vera-us-oem-authd11.mios.com

Thank you.

Could more have changed? I'm running UI7 Firmware v 1.7.388.

I get the MMS Session Token for all servers just fine, but when I start making calls and/or requests I get nothing back but errors.

For instance:

Code: [Select]
https://vera-us-oem-relay11.mios.com/relay/relay/relay/device/<PK_Device>/port_3480/data_request?id=variableget&Variable=PK_AccessPoint
Gives me the error: "(403) Forbidden" even as I'm pretty sure that I have and is using the right MMS Session token that I gor back from "vera-us-oem-relay11.mios.com" and is using it correct in a MMSSession header .

Similar but a little different error messages with::
 
Code: [Select]
https://<Server_Account>/account/account/account/<PK_Account>/devices where <Server_Account>  = "vera-us-oem-account11.mios.com".  Again I get the MSS Session Token for the server just fine, but I can't access the server anyway. The error I get is the error: "(404) Not Found."

The "funny part is that if I obmit the "/devices"-part and only do a request like this:
Code: [Select]
https://<Server_Account>/account/account/account/<PK_Account>
I then get a json string back that looks like this:

Code: [Select]
{"PK_Account_Parent":<xxxx>,"PK_Account_Parent2":1,"PK_AccountType":5,"PK_Oem":1,"Server_Event":"vera-us-oem-event12.mios.com","Server_Event_Alt":"vera-us-oem-event11.mios.com","Server_Account":"vera-us-oem-account12.mios.com","Server_Account_Alt":"vera-us-oem-account11.mios.com","Phone": [{"PK_Phone":<yyyyy>}]}

Any ideas? I'm pretty stuck here  :-(

« Last Edit: October 19, 2014, 10:40:35 am by jasperhb »

Offline garrettwp

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: My Notes on remote access for UI6
« Reply #20 on: October 19, 2014, 09:41:09 am »
Are you providing the token as a special header in your request? You must pass the token with your request via a header.

- Garrett


Offline jasperhb

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +1/-0
Re: My Notes on remote access for UI6
« Reply #21 on: October 19, 2014, 10:00:08 am »
Are you providing the token as a special header in your request? You must pass the token with your request via a header.

- Garrett

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.
« Last Edit: October 19, 2014, 10:41:00 am by jasperhb »

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10090
  • Karma: +762/-142
Re: My Notes on remote access for UI6
« Reply #22 on: October 19, 2014, 11:26:03 am »
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


Offline jasperhb

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +1/-0
Re: My Notes on remote access for UI6
« Reply #23 on: October 19, 2014, 01:12:15 pm »
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 ?
...

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 :-)

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

Offline shrik

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: My Notes on remote access for UI6
« Reply #24 on: November 05, 2014, 05:55:50 am »
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
« Last Edit: November 05, 2014, 06:07:40 am by shrik »

Offline wessiack

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: My Notes on remote access for UI6
« Reply #25 on: December 01, 2014, 10:01:13 am »
Does enybody has .NET Code covering logon to UI7 and some samples for sending requests?

thanks

:: Paul

Offline jasperhb

  • Sr. Newbie
  • *
  • Posts: 46
  • Karma: +1/-0
Re: My Notes on remote access for UI6
« Reply #26 on: December 03, 2014, 11:49:27 am »
Does enybody has .NET Code covering logon to UI7 and some samples for sending requests?

thanks

:: Paul

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. :-)
« Last Edit: December 03, 2014, 11:54:15 am by jasperhb »

Offline sgruby

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +3/-1
Re: My Notes on remote access for UI6
« Reply #27 on: December 14, 2014, 11:47:20 pm »
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.

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.

Offline garrettwp

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: My Notes on remote access for UI6
« Reply #28 on: December 15, 2014, 08:52:30 am »
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


Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10090
  • Karma: +762/-142
Re: My Notes on remote access for UI6
« Reply #29 on: December 15, 2014, 09:15:39 am »
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.