How does the Advanced HTTP option work in the Volume Plugin?


Most network-enabled devices allow control by posting data to them.  This is where the Advanced HTTP option comes in!  With this option you stand a very good chance of being able to control your device without having to wait for me to get around to it.  With a little Googling, you may be able to find sample POST or GET commands that allow you to control your device.  If you do, be sure to send me an email through the button in the app so that I can add built-in support so that others can control that device brand as well!

 

For an example, I will include a real sample of how to control a Panasonic VIERA television.  This has already been added to the Volume Plugin as a built-in supported device but it will help demonstrate how you would use the advanced HTTP option.

 

Here is the POST data that needs to be submitted to the device in order to send the mute command:

POST /nrc/control_0 HTTP/1.1
User-Agent: Panasonic iOS VR-CP UPnP/2.0
Host: 10.0.1.155:55000
Content-Type: text/xml; charset="utf-8"
SOAPACTION: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"
Content-Length: 331

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1">
<X_KeyEvent>NRC_MUTE-ONOFF</X_KeyEvent>
</u:X_SendKey>
</s:Body>
</s:Envelope>

In the Plugin app, you would do the following:

1) Set the IP address to the actual IP address of your television.  It is recommended that you use a static IP address or DHCP reservation so that the address will never change.  If that happens, you will need to change that setting in the plugin app.  The sample above shows the address as 10.0.1.155 with a port of 55000.  Your address will likely be different, but the port should be the same.

2) Edit the commands for each button in the plugin that are available on the device.  For example, for the Mute button you would enter NRC_MUTE-ONOFF.  Not all commands are available for all devices.  The plugin detects which commands are available and tries to act accordingly when you try pressing buttons in the main app.

3) Press on the 'Set Header/Body" button in the upper-right corner of the Commands screen.  This is where you enter the POST data.

For the header, you would enter the following into the app:

POST /nrc/control_0 HTTP/1.1
User-Agent: Panasonic iOS VR-CP UPnP/2.0
Host: $IP$:$PORT$
Content-Type: text/xml; charset="utf-8"
SOAPACTION: "urn:panasonic-com:service:p00NetworkControl:1#X_SendKey"
Content-Length: $LENGTH$

 

For the body, you would enter the following into the app:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1">
<X_KeyEvent>$COMMAND$</X_KeyEvent>
</u:X_SendKey>
</s:Body>
</s:Envelope>

 

If you are following along, you will see that we pretty much entered the original elements except that we replaced a few things with variables.  This will allow the POST data to change itself depending on which buttons you press in the app.

In the headers:

We replaced the original IP address and port (10.0.1.155:55000) with $IP$:$PORT$

We replaced the original Content-Length (331) with $LENGTH$

In the body:

We replaced the original command (NRC_MUTE-ONOFF) with $COMMAND$

 

Hopefully this helps give you an idea of how this option works.  It really can allow you to add support for your own device but it will take some Googling and some patience.  If you have problems, feel free to send me an email with a link to the information you have found.  I will either try to help you get it working and/or just add built-in support for it to the plugin app so that others can use it as well.

Tags: Advanced HTTP
Last update:
2012-11-25 17:02
Author:
Administrator
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags

Sticky FAQs