Jump to content

Network Module Rules


db2ace2

Recommended Posts

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

Link to comment

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
Link to comment

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

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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.

Link to comment
  • 3 weeks later...
  • 1 month later...

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

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...