Jump to content

Network Module Rules


db2ace2

Recommended Posts

Posted

Hi Pazium,

 

Unfortunately not having a complete payload of what the TV expects, we'll be playing roulette. Is there a way to get that? Do you need to provide userid/password (not device id/info)?

 

With kind regards,

Michel

Posted

ok, Still at it, Michel.
 
I have done some WireShark work. I have attached 2 screen captures: WS1 and WS2
WS1.png is the message the Bravia sends back just before the 500 error.
I also include the 500 error capture from WireShark, WS 2.
 
What does the Bravia want in WS1?
 
Thanx
Mike

post-2403-0-10933600-1429499722_thumb.png

post-2403-0-59822100-1429499731_thumb.png

Posted

no, it doesnt expect a user id and password 

the successful response from the working Bravia is this

 

HTTP/1.1 200 OK
Content-Type: text/xml;charset="utf-8"
Content-Length: 375
Connection: keep-alive
Server: Linux/2.6 UPnP/1.0 DMR/1.7
Ext: 
ACCESS-CONTROL-ALLOW-ORIGIN: *
Date: Mon, 20 Apr 2015 14:46:17 GMT
 
 
i researched that this
ACCESS-CONTROL-ALLOW-ORIGIN: *
no need for an origin value
Posted

Hi Pazium,

 

Thank you. But, what we need is a payload "that works" and does not return any errors. Once we have that payload, then we can input into ISY and see whether or not we get that error.

 

Do you have anything that can make the correct call and get Bravia to respond correctly?

 

With kind regards,

Michel

Posted

accessCiontrol doesn't exist in this Bravia 

I ran wireshark after running commands and the Bravia didn't know what it was.

 

I don't recall this model asking for a PIN like TiVo does though, TV Sideview didn't ask for one. My Sony Experia didn't need one and neither PlayMemores for Windows or my Surface Pro 3

I need it to recognize/register the ISY in the same way, I think.

 

I'll plunge back in tonight 

 

Thanx for checking in

 

I am also Ottermator somewhere else and when in this forum. You'll see my previous questions and efforts

Posted

I'll send it to you.

 

Check out this API: https://github.com/KHerron/SonyAPILib/blob/master/README.md

My model (KDL-48W600b) requires a script to be run which "registers" the new virtual remote with the TV.

Oddly, I copied and pasted the script from the API for registration into a network resource on the ISY - and the ISY registered as OK.

I did the same for my PC, which also registered as OK.

But, when I ran the commands from my PC, it worked fine - same commands on the ISY register a response of 500.

Posted

Here is the script I ran to register my ISY to the TV.  Its literally a copy/paste from the API I mentioned.

Just be sure to manually replace the "your.ISY.ip", "your.TVs.ip", and "YourAuthenticationCode".

The authentication code comes from the manual registration page in settings on the TV itself.

 

public bool sendAuth(string YourAuthenticationCode)
            {
                bool reg = false;
                string your.tvs.IP = this.Server_Name;
                string jsontosend = "{\"id\":13,\"method\":\"actRegister\",\"version\":\"1.0\",\"params\":[{\"clientid\":\"" + your.tvs.IP + ":34c43339-af3d-40e7-b1b2-743331375368c\",\"nickname\":\"" + your.tvs.IP + "\"},[{\"clientid\":\"" + your.tvs.IP + ":34c43339-af3d-40e7-b1b2-743331375368c\",\"value\":\"yes\",\"nickname\":\"" + your.tvs.IP + "\",\"function\":\"WOL\"}]]}";
                try
                {
                    var httpWebRequest2 = (HttpWebRequest)WebRequest.Create(@"http://" + your.ISY.IP + @"/sony/accessControl");
                    httpWebRequest2.ContentType = "application/json";
                    httpWebRequest2.Method = "POST";
                    httpWebRequest2.AllowAutoRedirect = true;
                    httpWebRequest2.CookieContainer = allcookies;
                    httpWebRequest2.Timeout = 500;
                    using (var streamWriter = new StreamWriter(httpWebRequest2.GetRequestStream()))
                    {
                        streamWriter.Write(jsontosend);
                    }
                    string authInfo = "" + ":" + YourAuthenticationCode;
                    authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
                    httpWebRequest2.Headers["Authorization"] = "Basic " + authInfo;
                    var httpResponse = (HttpWebResponse)httpWebRequest2.GetResponse();
                    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        var responseText = streamReader.ReadToEnd();
                        _Log.writetolog("Registration response: " + responseText, false);
                        this.Registered = true;
                        reg = true;
                    }
                    string answerCookie = JsonConvert.SerializeObject(httpWebRequest2.CookieContainer.GetCookies(new Uri("http://" + your.ISY.IP + "/sony/appControl")));
                    System.IO.StreamWriter file = new System.IO.StreamWriter("cookie.json");
                    file.WriteLine(answerCookie);
                    file.Close();
                    this.Cookie = answerCookie;
                }
                catch
                {
                    _Log.writetolog("Registration process Timed Out", false);
                    this.Registered = false;
                }
                return reg;
            }
            #endregion

Posted

It's in network settings. I think the header is WiFi Direct. The description will say "to connect devices on your network to the TV" or something like that. Instead of doing what it asks you to do when you get in there, look for the option of manual registration. That's where you get the manual registration authentication code.

You have to leave your TV on that page with the code up while you register the device.

 

 

Sent from my iPhone using Tapatalk

Posted

I get a failure and an N/A response with POSTing  this

 

POST / HTTP/1.1
Host: 169.254.70.83:80
User-Agent: Mozilla/4.0
Connection: Close
Content-Type: application/x-www-form-urlencoded
Content-Length: 2593
 
public bool sendAuth(string YourAuthenticationCode)
            {
                bool reg = false;
                string 169.254.70.83 = this.Server_Name;
                string jsontosend = "{\"id\":13,\"method\":\"actRegister\",\"version\":\"1.0\",\"params\":[{\"clientid\":\"" + 169.254.70.83 + ":34c43339-af3d-40e7-b1b2-743331375368c\",\"nickname\":\"" + 169.254.70.83 + "\"},[{\"clientid\":\"" + 169.254.70.83 + ":34c43339-af3d-40e7-b1b2-743331375368c\",\"value\":\"yes\",\"nickname\":\"" + 169.254.70.83 + "\",\"function\":\"WOL\"}]]}";
                try
                {
                    var httpWebRequest2 = (HttpWebRequest)WebRequest.Create(@"http://" + 192.168.1.13 + @"/sony/accessControl");
                    httpWebRequest2.ContentType = "application/json";
                    httpWebRequest2.Method = "POST";
                    httpWebRequest2.AllowAutoRedirect = true;
                    httpWebRequest2.CookieContainer = allcookies;
                    httpWebRequest2.Timeout = 500;
                    using (var streamWriter = new StreamWriter(httpWebRequest2.GetRequestStream()))
                    {
                        streamWriter.Write(jsontosend);
                    }
                    string authInfo = "" + ":" + 3752Rvwj;
                    authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
                    httpWebRequest2.Headers["Authorization"] = "Basic " + authInfo;
                    var httpResponse = (HttpWebResponse)httpWebRequest2.GetResponse();
                    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        var responseText = streamReader.ReadToEnd();
                        _Log.writetolog("Registration response: " + responseText, false);
                        this.Registered = true;
                        reg = true;
                    }
                    string answerCookie = JsonConvert.SerializeObject(httpWebRequest2.CookieContainer.GetCookies(new Uri("http://" + 192.168.1.13 + "/sony/appControl")));
                    System.IO.StreamWriter file = new System.IO.StreamWriter("cookie.json");
                    file.WriteLine(answerCookie);
                    file.Close();
                    this.Cookie = answerCookie;
                }
                catch
                {
                    _Log.writetolog("Registration process Timed Out", false);
                    this.Registered = false;
                }
                return reg;
            }
             #endregion
           

How does it look?

 I appreciate your time.

  • 3 weeks later...
Posted

No, registration occurs in a different section of the settings.  Look up in the user guide how to register a mobile device.  That will give you a four digit PIN.  That's the registration PIN.

  • 1 month later...
Posted

Just an update - I'm still not able to get usable packets monitoring my network traffic. Additionally, Sony updated their firmware and now includes an option in the settings for developers to send commands over network - but no documentation on it.

 

I found it much easier to just use the new IFTTT channel (Maker) to build network resources that send commands to my Harmony Ultimate Hub. That gets the job done.

 

 

Sent from my iPhone using Tapatalk

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...