Hey Guys,
since the official Yamaha Receiver Binding did not support setting the Pure Direct Mode on/off, yet, I’ve written a small rule to handle this.
The IP address of the receiver needs to be adjusted to fit your environment.
Items file:
String Yamaha_PureDirect_Result "Result: [%s]"
Rules file:
var String result
rule "Yamaha Pure Direct"
when
Item Yamaha_PureDirect changed
then
val String urlString = "http://xxx.xxx.xxx.xxx:80/YamahaRemoteControl/ctrl"
val String contentType = "text/xml"
val String contentString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Sound_Video><Pure_Direct><Mode>COMMAND</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>"
// Set pure direct mode on or off
if( Yamaha_PureDirect.state == ON ) {
logDebug("Rules.YamahaReceiver.SetPureDirectMode", urlString + contentType + contentString.replace("COMMAND", "On"))
logDebug("Rules.YamahaReceiver.SetPureDirectMode", "Set Pure Direct Mode: On")
result = sendHttpPostRequest(urlString, contentType, contentString.replace("COMMAND", "On"))
} else {
logDebug("Rules.YamahaReceiver.SetPureDirectMode", urlString + contentType + contentString.replace("COMMAND", "Off"))
logDebug("Rules.YamahaReceiver.SetPureDirectMode", "Set Pure Direct Mode: Off")
result = sendHttpPostRequest(urlString, contentType, contentString.replace("COMMAND", "Off"))
}
// Log error if respond is not valid
if( result != "<YAMAHA_AV rsp=\"PUT\" RC=\"0\"><Main_Zone><Sound_Video><Pure_Direct><Mode></Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>" ) {
logError("Rules.YamahaReceiver.SetPureDirectMode", result)
}
end
I hope this will serve you well until it’s taken over to the official binding.
Best regards
Stephan