Sunday, March 30, 2014

Control4 - Uncovering SOAP Commands

I've currently been using the Programming interface in ComposerHE to figure out SOAP commands. It has been good for lighting, but ideally I want to do everything the MyHome iOS/Android app can do such as controlling the volume, changing channels, thermostat, etc.

Luckily, there is a method to capture the SOAP commands sent from the MyHome app. So far, I've only tried this on Android

Step 1 - Packet Capture:

Requirements:

Steps:

  1. Install tPacketCapture and Wireshark
  2. Start Capturing
  3. Open MyHome Application
  4. Perform functions that you would like to capture
  5. Stop Capturing
  6. Upload pcap file to PC via USB/Email

Step 2 - Filtering the data

  1. Open the pcap file in Wireshark
  2. Use the following filter: frame matches "(?i)sendtodevice"

You'll have to read through the filtered message to find what's relevant to your command. I wanted to determine the volume up, volume down, info, and cancel buttons. The following was captured for volume down:


SOAP Command captured from Wireshark:

<c4soap name="SendToDeviceAsync" async="1" seq="866">
<param name="iddevice" type="number">10</param>
<param name="data" type="string">
<devicecommand>
<command>PULSE_VOL_DOWN</command>
<params></params>
</devicecommand>
</param>
</c4soap>

The iddevice number is 10. For my Control4 system 10 is the family room. In an earlier post I showed how to list Director items by ID. I modified the script to list rooms. The script is called getControl4Rooms.py. The modification was really trivial, but I uploaded the script in case there's people that aren't familiar with python.

Step 3 - Sending SOAP Command with Python

If you clone my git repo there will be a script called TestSendSOAP.py. You can insert the message that you captured in Wireshark to test it out.

If anything is unclear, please let me know. This is far from complete. I'm not sure if some commands only work if the system is in a specific state. I'm currently working on encapsulating Control4 items in a python module. Lighting is currently implemented and will be a future post, but the code is on git.

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thanks for sharing. I tried to use your technique, but my Control4 system seems to use SSL. Do you think this is something they changed in the past year?

    ReplyDelete
    Replies
    1. No problem. I worked on that a year ago. I'm not sure how the system has changed. I don't have access to a control 4 system anymore, otherwise I'd check.

      Delete
  3. thanks due to the fact you have been precise-natured to percentage opinion subsequent to us. we are able to continually recognize all you have finished here because I understand you are selected worried thinking about our. control4

    ReplyDelete