Custom XML Commands

Hi, I am another iRule to Simple Control convert.

I have almost everything working with Simple control but I am struggling with one of my custom devices. My Yamaha receiver has 4 zones. The built-in definitions only cover zone 1 & 2. I have gone through the DDK documentation and added custom codes. However, the codes for the Yamaha are XML and I think I have the formatting messed up. Has anyone else run into this? Below is what the config looks like:

	<dict>
		<key>brand</key>
		<string>Yamaha</string>
		<key>cat</key>
		<string>Zone 3</string>
		<key>codes</key>
		<dict>
			<key>POWER OFF</key>
			<string>POST /YamahaRemoteControl/ctrl
			Content-Type: text/xml
			
			&lt;YAMAHA_AV cmd="PUT"&gt;&lt;Zone_3&gt;&lt;Power_Control&gt;&lt;Power&gt;Standby&lt;/Power&gt;&lt;/Power_Control&gt;&lt;/Zone_3&gt;&lt;/YAMAHA_AV&gt;</string>
			<key>POWER ON</key>
			<string>POST /YamahaRemoteControl/ctrl
			Content-Type: text/xml
			
			&lt;YAMAHA_AV cmd="PUT"&gt;&lt;Zone_3&gt;&lt;Power_Control&gt;&lt;Power&gt;On&lt;/Power&gt;&lt;/Power_Control&gt;&lt;/Zone_3&gt;&lt;/YAMAHA_AV&gt;</string>
		</dict>
		<key>method</key>
		<string>http</string>
		<key>type</key>
		<integer>16</integer>
	</dict>

The raw XML is:
<YAMAHA_AV cmd=“PUT”><Zone_3><Power_Control>On</Power_Control></Zone_3></YAMAHA_AV>

BBEdit wont save the file unless I escape the characters.

Thanks!

  • Brad

I did not have any success combining custom commands with the predefined ones. i think you can only have one or the other. I deleted the predefined device, added my custom plist with all the commands I needed, updated the config file, and then re-added the receiver with the new commands as defined by only my new plist.

Thanks for the response. I added a new device manually for use with the custom commands. When sniffing the network traffic I can see a command being sent to the device, but the the XML data isn’t present. Do you happen to have examples of custom codes for Yamaha or any other device that requires XML commands?

Thanks again,

  • Brad

Watch out with the leading space before the header. It seems to matter. I had a similar issues (not XML, but needing to pass Basic Auth header) and it didn’t work till I noticed the HTTP example in the DDK documentation explicitly removes the indents before the header lines and the content.

1 Like

That was it! Thank you so much for responding, I don’t think I would have caught that!
This is the working version if anyone else runs into this issue:

	<dict>
		<key>brand</key>
		<string>Yamaha</string>
		<key>cat</key>
		<string>Zone 3</string>
		<key>codes</key>
		<dict>
			<key>POWER OFF</key>
			<string>POST /YamahaRemoteControl/ctrl

Content-Type: text/xml; charset=UTF-8

<?xml version="1.0"?>
<YAMAHA_AV cmd="PUT"><Zone_3><Power_Control><Power>Standby</Power></Power_Control></Zone_3></YAMAHA_AV>
POWER ON
POST /YamahaRemoteControl/ctrl
Content-Type: text/xml; charset=UTF-8

<?xml version="1.0"?>
<YAMAHA_AV cmd="PUT"><Zone_3><Power_Control><Power>On</Power></Power_Control></Zone_3></YAMAHA_AV>

method
http
type
16

1 Like

I have what I think is the same problem. I can’t see the changes you made, would you possibly be able to point them out? I’m new at programming.