Yamaha Blu Ray Player

Is there a known issue with Yamaha Blue Ray players. It gets detected but immediately errors 400

I was trying to create a plug in but I’m having trouble with that as well. When I add the data/body text, the post switches from http to tcp and fails. I was able to post via postman. I have tried multiple different content types.

plugin.Name = “YamahaBDS677”;
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = -1;
plugin.DefaultSettings = {
“Host” : “10.37.230.52”
};
var mediaCommandMappings = {
“PowerOff” : “<Power_Control>Off</Power_Control>”,
“PowerOn” : “<Power_Control>On</Power_Control>”,
“OpenClose” : “<Remote_Control><RC_Code>7c81</RC_Code></Remote_Control>”,
“Open” : “<Tray_Control>Open</Tray_Control>”,
“Close” : “<Tray_Control>Close</Tray_Control>”,
};
var http = new HTTPClient();

function onChangeRequest(device, attribute, value) {
console.log(“onChangeRequest called…”);
var cmd;
console.log(attribute + " " + value);
switch(attribute) {
case “MediaCommand”:
console.log(“step mediacommand”);
cmd = mediaCommandMappings[value];
break;
case “Switch”:
console.log(“step switch”);
if(value == “On”) {
cmd = mediaCommandMappings[“PowerOn”];
} else {
cmd = mediaCommandMappings[“PowerOff”];
}
break;
}

//http://g33ksblog.blogspot.com/2013/08/yamaha-network-control.html
var host = plugin.Settings[“Host”];
var baseURL = “http://” + host + “:50100/YamahaRemoteControl/ctrl?” ;

cmd = '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Remote_Control><RC_Code>7c81</RC_Code></Remote_Control></Main_Zone></YAMAHA_AV>'

var xmlheaders2 = {'Content-Type': 'text/xml'};
var xmlheaders = {'Content-Type': 'application/xml'};
var plainHeaders = {'Content-Type':'text/plain'}

var htmlHeaders = {‘Content-Type’:‘text/html’}

console.log(baseURL  + cmd);
http.post(cmd,cmd,{baseURL:baseURL,headers: htmlHeaders });

}

function onConnect() {
}

function onDisconnect() {
}

function onPoll() {
}

function onSynchronizeDevices() {
var device = new Device();
device.Id = “1”;
device.DisplayName = “YamahaBDS677”;
device.Capabilities = [“Switch”,“MediaControl”];
device.Attributes = [];
plugin.Devices[device.Id] = device;
}

The official Yamaha integrations are for their AV receivers & speakers. I don’t think you’ll get those working for a Blu-Ray. It’s never been tested for that. You likely will need a plugin.

You need to look closer at your “http.put”. The 1st parameter is the URL, the 2nd is the data. It should look something like this:

http.put(baseURL, cmd, {headers: htmlHeaders }); 

The built in integration could work but since it wasn’t set up for the Blu-Ray it’s not sending the correct info. I see it connecting but the payload is empty.

My URL was a little messy but I was working with the first thing that worked with postman. I was emulating the URL from iRule. After I walked away for awhile I came back. Even after I cleaned it up it still doesn’t work. If I send a zero length string for the data the post goes out as a HTTP request but if I put anything in (“Hi” for an example) the request is sent as TCP instead. I’m watching the transactions in wire shark.

        var baseURL = "http://" + host + ":" + port; 
        var url = "/YamahaRemoteControl/ctrl?"
        
        baseURL = baseURL + url
        var plainHeaders = {'Content-Type': 'text/plain'};            
        console.log(baseURL + " "  + cmd + "Content-Length: " + cmd.length);
        cmd = ""
        http.post(baseURL,cmd,{headers: plainHeaders});

HTTP uses TCP. That’s not your issue. Whenever I troubleshoot HTTP with Wireshark I usually set the filter to something like this to hide those TCP messages:

ip.dst == 192.168.1.203 && http

Do you know how the integration is sending the post? I checked the request that it’s sending again. It looks fine except “GetParam” must not be a command that the Blu-Ray recognizes.

I know just enough about web protocols to be annoying and dangerous. When I compare the postman, integration and the web client request. each line from postman and the integration are suffixed with “\r\n” where the web client isn’t

web client:
POST /YamahaRemoteControl/ctrl HTTP/1.1
Content-Type: text/xml; charset=utf-8
Host: 10.37.250.52:50100
Content-Length: 152
Expect: 100-continue
Connection: Keep-Alive

Yamaha integration (looks similar to the postman that works):
Hypertext Transfer Protocol
POST /YamahaRemoteControl/ctrl HTTP/1.1\r\n
Connection: Keep-Alive\r\n
Content-Type: text/xml; charset=utf-8\r\n
Accept-Encoding: gzip, deflate\r\n
Content-Length: 120\r\n
Host: 10.37.250.52:50100\r\n
\r\n

Or is the “Expect” that is hosing things up?

I don’t know if that makes any difference.

I see a request to send the body of 175 characters then see the continue response and the acknowledgments, the message body doesn’t get sent

if the HTTP client is using curl, the Except header is added by default, Supposedly it can be disabled by setting the header explicitly with an empty string but that didn’t work. I tried setting an invalid value (Expect:0) just to see what would happen, “, 100-continue” was appended to it. (Expect:0, 100-continue)

I can look into removing Expect from the plugin’s simulator HTTPClient. The actual apps themselves probably don’t include Expect. So try testing your Plugin in the actual apps to see if your request works.

That did work!

That’s the last device to integrate

Good to hear! Yeah, I’ll try to update the simulator in the next release.