communicating with a Smart Plug

I have an XB24-B configured as a ZigBee coordinator and connected to my computer via a Sparkfun USB dongle. I also have an XBee Smart Plug. The associate LED is blinking, indicating the Smart Plug has joined the network. I can issue AT commands to the XB24-B via minicom. What do I need to do in order to query the Smart Plug and get some basic info from it (serial number, etc.). Can the relay be switched on and off with simple AT commands or do I need to write some kind of Python script to talk with it?

Here is a link to a page about the Smart Plug from our python mediawiki:

I copy this link not because Python is required to use the Smart Plug, but due to the fact that it shows the values you’d set the D4 register to in order to turn On/Off the AC socket.

The WR immediatly after the place those commands are used is to WRite the setting change to the XBee, and the AC is to Apply the Changes.

Thanks. This definitely points me in the right direction. Is a ConnectPort gateway absolutely required or should it be possible to control the Smart Plug with the minimal equipment I have? Most of the code I’ve found is written to be used with a ConnectPort.

Of course you do not need a ConnectPort. The code sample shows the messages you need to format.

You can talk serially via a XBIB or other USB-XBee. There are other wiki pages which explain how to format API frames.

In the Smart Plug Interactive Demo there is a function, parseIS(data), that unpacks the sample into usable info. The data format can be inferred from this function, but I’m wondering if there is a specification document that describes the data format for the Smart Plug and other devices like XBee Sensor.

I’ve looked on the respective wiki pages but the sample data format is not described.

– James –

It is within the XBee PDF document - look up the “I/O Sampling” section.

Those devices are just returning a small packed binary format with a 16-bit digital array and up to 4 (or 5) analogs as 16-bit. The real secret is how to turn the binary value for temperature or current from 0-1024 to a degree or voltage.

Thanks Lynn!

Here is the document for others that may be looking:

– James –