Connected by TCP API


** Important ** Connected by TCP has updated the communication methods to make a more secure connection between client and gateway.  As such, this API is no longer working.  I am working on understanding the new protocol and building a new API.

I have created a GIT Repository for the Node.js implementation of the Connected by TCP Lights API. In its current state it will turn on and off the lights in a room by passing the name of the room. Check out the exmaples folder for this demo.

A long while back I heard about the Phillips Hue light bulbs and thought it was a neat concept but at the price point I never saw it worth the cost.

So last weekend I was doing research into different options and I saw some lower cost options like Limitless LED and I was about to buy a couple bulbs to try them when I stumbled across the Connected by TCP system.  I quickly learned that they had a deal worked out with Home Depot to get a Starter Pack for $50!  Additional bulbs are available at the following places:

I did some looking for any type of API to control the system without using the included apps and came up empty.

I wasn’t too worried as I figured that at this price they would likely be hacked soon enough so I decided to go for it.  So I made the drive 30 miles to the nearest Home Depot and picked some up that day.

I got them hooked up and could control them using the supplied applications and the local web server application that came included.  But I wanted to control them beyond the included apps, so I started down the road of reverse engineering the protocol to see if I could at least duplicate the commands. I got some snapshots of the commands being sent from the web interface.  This one is turning on a light bulb.

Request URL:http://192.168.1.137/gwr/gop.php
Request Method:POST
Status Code:200 OK

Request Headers
Accept:application/xml, text/xml, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:186
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Host:192.168.1.137
Origin:http://192.168.1.137
Referer:http://192.168.1.137/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36

Form Data
cmd:DeviceSendCommand
data:<gip><version>1</version><token>1234567890</token><did>216446448844665715</did><value>1</value></gip>
fmt:xml

Response Headers
Connection:Close
Content-Length:43
Content-Type:text/xml
Date:Mon, 20 Jan 2014 04:59:12 GMT
Server:Cherokee/1.2.101 (UNIX)

All of the commands go the following url:

http://192.168.1.137/gwr/gop.php

It takes post commands in the form of:

cmd=[command]&data=[data]&fmt=xml

Get System Status

The following is the command that the web interface uses.  From looking at the command, I believe it could be simplified to leave out the UserGetListDefaultRooms and UserGetListDefaultColors

[command]=GWRBatch

[data]=

<gwrcmds>
    <gwrcmd>
        <gcmd>RoomGetCarousel</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <token>1234567890</token>
                <fields>name,control,power,product,class,realtype,status</fields>
            </gip>
        </gdata>
    </gwrcmd>
    <gwrcmd>
        <gcmd>UserGetListDefaultRooms</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <token>1234567890</token>
            </gip>
        </gdata>
    </gwrcmd>
    <gwrcmd>
        <gcmd>UserGetListDefaultColors</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <token>1234567890</token>
            </gip>
        </gdata>
    </gwrcmd>
</gwrcmds>

This returns a format like:

<gwrcmds>
    <gwrcmd>
        <gcmd>RoomGetCarousel</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <rc>200</rc>
                <room>
                    <rid>1</rid>
                    <name>Living Room</name>
                    <desc/>
                    <known>1</known>
                    <type>0</type>
                    <color>00bd1f</color>
                    <colorid>1</colorid>
                    <img>img/room/green.png</img>
                    <power>0</power>
                    <poweravg>0</poweravg>
                    <energy>0</energy>
                    <device>
                        <did>216446448845011066</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <offline>1</offline>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Living Room 2</name>
                        <desc>LED</desc>
                        <colorid>1</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>1</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>1</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability/>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
                        <did>216446448845011750</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <offline>1</offline>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Living Room 1</name>
                        <desc>LED</desc>
                        <colorid>1</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>1</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>1</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability/>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                </room>
                <room>
                    <rid>3</rid>
                    <name>Bedroom</name>
                    <desc/>
                    <known>1</known>
                    <type>0</type>
                    <color>e30000</color>
                    <colorid>3</colorid>
                    <img>img/room/red.png</img>
                    <power>0</power>
                    <poweravg>0</poweravg>
                    <energy>0</energy>
                    <device>
                        <did>216446448845005167</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <offline>1</offline>
                        <node>0</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Closet</name>
                        <colorid>3</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup/>
                            <manufacturer>TCP</manufacturer>
                        </other>
                    </device>
                    <device>
                        <did>216446448845005950</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>1</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Bedroom 1</name>
                        <desc>LED</desc>
                        <colorid>3</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0.011</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>3</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
                        <did>216446448845006086</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>1</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Bedroom 1</name>
                        <desc>LED</desc>
                        <colorid>3</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0.011</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>3</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                </room>
                <room>
                    <rid>4</rid>
                    <name>Bathroom</name>
                    <desc/>
                    <known>1</known>
                    <type>0</type>
                    <color>dde500</color>
                    <colorid>4</colorid>
                    <img>img/room/yellow.png</img>
                    <power>0</power>
                    <poweravg>0</poweravg>
                    <energy>0</energy>
                    <device>
                        <did>216446448845005531</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Vanity 3</name>
                        <desc>LED</desc>
                        <colorid>4</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup/>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
                        <did>216446448844665715</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Vanity 2</name>
                        <desc>LED</desc>
                        <colorid>4</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>4</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
                        <did>216446448845004085</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Vanity 4</name>
                        <desc>LED</desc>
                        <colorid>4</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>4</rcgroup>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                </room>
                <room>
                    <rid>6</rid>
                    <name>Kitchen</name>
                    <desc/>
                    <known>1</known>
                    <type>4</type>
                    <color>fa8a00</color>
                    <colorid>6</colorid>
                    <img>img/room/orange.png</img>
                    <power>0</power>
                    <poweravg>0</poweravg>
                    <energy>0</energy>
                    <device>
                        <did>359697498088450516</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>1</state>
                        <level>100</level>
                        <node>0</node>
                        <port>0</port>
                        <nodetype>61440</nodetype>
                        <name>Kitchen Roof</name>
                        <desc/>
                        <colorid>6</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0.022</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand/>
                        <prodmodel/>
                        <prodtype>Light Fixture</prodtype>
                        <prodtypeid>159</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup/>
                            <manufacturer/>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
               &bbsp;        <did>359978973065161172</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <offline>1</offline>
                        <node>0</node>
                        <port>0</port>
                        <nodetype>61440</nodetype>
                        <name>Island</name>
                        <desc/>
                        <colorid>6</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>1</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand/>
                        <prodmodel/>
                        <prodtype>Light Fixture</prodtype>
                        <prodtypeid>159</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup/>
                            <manufacturer/>
                            <capability/>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                    <device>
                        <did>360260448041871828</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>1</state>
                        <level>100</level>
                        <node>0</node>
                        <port>0</port>
                        <nodetype>61440</nodetype>
                        <name>Kitchen Table</name>
                        <desc/>
                        <colorid>6</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0.055</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand/>
                        <prodmodel/>
                        <prodtype>Light Fixture</prodtype>
                        <prodtypeid>159</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup>2</rcgroup>
                            <manufacturer/>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                </room>
                <room>
                    <rid>7</rid>
                    <name>Entryway</name>
                    <desc/>
                    <known>1</known>
                    <type>0</type>
                    <color>4bc3de</color>
                    <colorid>7</colorid>
                    <img>img/room/aqua.png</img>
                    <power>0</power>
                    <poweravg>0</poweravg>
                    <energy>0</energy>
                    <device>
                        <did>216446448845011135</did>
                        <known>1</known>
                        <lock>0</lock>
                        <state>0</state>
                        <level>100</level>
                        <node>230</node>
                        <port>0</port>
                        <nodetype>16386</nodetype>
                        <name>Entryway</name>
                        <desc>LED</desc>
                        <colorid>7</colorid>
                        <type>multilevel</type>
                        <rangemin>0</rangemin>
                        <rangemax>99</rangemax>
                        <power>0</power>
                        <poweravg>0</poweravg>
                        <energy>0</energy>
                        <score>0</score>
                        <productid>1</productid>
                        <prodbrand>TCP</prodbrand>
                        <prodmodel>LED A19 11W</prodmodel>
                        <prodtype>LED</prodtype>
                        <prodtypeid>78</prodtypeid>
                        <classid>2</classid>
                        <class/>
                        <subclassid>1</subclassid>
                        <subclass/>
                        <other>
                            <rcgroup/>
                            <manufacturer>TCP</manufacturer>
                            <capability>productinfo,identify,meter_power,switch_binary,switch_multilevel</capability>
                            <bulbpower>11</bulbpower>
                        </other>
                    </device>
                </room>
            </gip>
        </gdata>
    </gwrcmd>
    <gwrcmd>
        <gcmd>UserGetListDefaultRooms</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <rc>200</rc>
                <room>
                    <id>1</id>
                    <name>Other</name>
                    <desc>Other</desc>
                </room>
                <room>
                    <id>2</id>
                    <name>Living Room</name>
                    <desc>Living Room</desc>
                </room>
                <room>
                    <id>3</id>
                    <name>Bedroom</name>
                    <desc>Bedroom</desc>
                </room>
                <room>
                    <id>4</id>
                    <name>Kitchen</name>
                    <desc>Kitchen</desc>
                </room>
                <room>
                    <id>5</id>
                    <name>Dining Room</name>
                    <desc>Dining Room</desc>
                </room>
                <room>
                    <id>6</id>
                    <name>Family Room</name>
                    <desc>Family Room</desc>
                </room>
                <room>
                    <id>7</id>
                    <name>Bathroom</name>
                    <desc>Bathroom</desc>
                </room>
                <room>
                    <id>8</id>
                    <name>Garage</name>
                    <desc>Garage</desc>
                </room>
                <room>
                    <id>9</id>
                    <name>Laundry Room</name>
                    <desc>Laundry Room</desc>
                </room>
                <room>
                    <id>10</id>
                    <name>Utility Room</name>
                    <desc>Utility Room</desc>
                </room>
                <room>
                    <id>11</id>
                    <name>Office</name>
                    <desc>Office</desc>
                </room>
                <room>
                    <id>12</id>
                    <name>Hallway / Stairway</name>
                    <desc>Hallway / Stairway</desc>
                </room>
                <room>
                    <id>13</id>
                    <name>Exterior</name>
                    <desc>Exterior</desc>
                </room>
            </gip>
        </gdata>
    </gwrcmd>
    <gwrcmd>
        <gcmd>UserGetListDefaultColors</gcmd>
        <gdata>
            <gip>
                <version>1</version>
                <rc>200</rc>
                <color>
                    <id>0</id>
                    <name>Black</name>
                    <value>000000</value>
                </color>
                <color>
                    <id>1</id>
                    <name>Green</name>
                    <value>00bd1f</value>
                </color>
                <color>
                    <id>2</id>
                    <name>Blue</name>
                    <value>004fd9</value>
                </color>
                <color>
                    <id>3</id>
                    <name>Red</name>
                    <value>e30000</value>
                </color>
                <color>
                    <id>4</id>
                    <name>Yellow</name>
                    <value>dde500</value>
                </color>
                <color>
                    <id>5</id>
                    <name>Purple</name>
                    <value>845fcf</value>
                </color>
                <color>
                    <id>6</id>
                    <name>Orange</name>
                    <value>fa8a00</value>
                </color>
                <color>
                    <id>7</id>
                    <name>Aqua</name>
                    <value>4bc3de</value>
                </color>
                <color>
                    <id>8</id>
                    <name>Pink</name>
                    <value>ff59b7</value>
                </color>
                <color>
                    <id>9</id>
                    <name>White</name>
                    <value>ffffff</value>
                </color>
            </gip>
        </gdata>
    </gwrcmd>
</gwrcmds>

Turn Individual Lights On & Off

[command]=DeviceSendCommand

[deviceid] is a individual light bulb above or a light fixture which can be obtained from the above system status.

[value] is 1 for on and 0 for off

<gip>
    <version>1</version>
    <token>1234567890</token>
    <did>[deviceid]</did>
    <value>[value]</value>
</gip>

Set Individual Lights Brightness Level

[command]=DeviceSendCommand

[deviceid] is a individual light bulb above or a light fixture which can be obtained from the above system status.

[value] is 0 to 100

[data]=

<gip>
    <version>1</version>
    <token>1234567890</token>
    <did>[deviceid]</did>
    <value>[value]</value>
    <type>level</type>
</gip>

I have some basic PHP classes written to interact with my lights.  Let me know in the comments if there is more of the system that you would like to see documented.

If there is enough interest I could document the process for which is used to setup these lights with the base.





9 responses to “Connected by TCP API”

  1. So glad someone is developing for lights which can be polled for state! I am going to buy these now, and with a Ninja Blocks device on the way I will soon be a tester for your driver. Hope to see more development on these!!

  2. I was previously successful in makimg this work, but recently it stopped working. I’ve since found out that my gateway will talk only to port 443 ( no longer port 80 ). Have anyone else having problems with this now? Even using port 443 with the GWRBatch in only answers ‘1401’.

    • They say on the tcpi site that they turned off the local web server for security reasons… I won’t let mine connect to the internet so it can’t get their update.. Hopefully they also turned off the SSH server with the hard coded root password… I noticed the range on my system is abysmal… can anyone else comment? I have 2 bulbs in my bedroom and the gateway has to be within about 15 feet of them to work.. I put a bulb on the main floor and it works unreliably and when it’s outside it doesn’t work at all. I moved the gateway to the main floor and it couldn’t see either light… I don’t have a very big house… Anyone else having this problem or did I get another dud?

    • Trying to get this working as well, but apparently something has changed, either with the port or something else. Any ideas guys?

      Cheers

    • I am having this problem too. Guessing there’s an issue involving an encryption pair, but not sure just where to start.

  3. I’ve been building a Pebble Watch app for the Connected Lights and doing a similar thing.

    Do you want to move your documentation to a wiki under you github project? I can help with what I find.

Leave a Reply

Your email address will not be published.