I’ve been playing with my new Smarthome 2413U PowerLinc Modem plus some Smarthome 2456S3 ApplianceLinc modules and two old X10 modules I had sitting around.
Insteon is a vast improvement over the X10 technology for home automation. X10 always had problems with messages getting “lost”, and it was really slow, sometimes taking up to a second for the light to actually turn on. Insteon really seems to live up to its name; the signals seem to get there immediately (to a human, anyway). Insteon also offers “dual-band” technology, meaning the signals are sent both over the electrical wiring of the house, and over a wireless network. On top of this, Insteon implements “mesh networking”, acknowledgements, and retries. The mesh networking means that even if two devices can’t directly communicate, if an intermediate device can see both, it will relay the signal.
Now, where Insteon seems to have improved leaps and bounds on the hardware, the software support is abysmal. That’s not because there’s anything wrong with the API, but because they’ve put the Software Development Kit (SDK) behind a hefty license fee, not to mention a rather evil license agreement. Basically it would preclude you from using any of their examples or source code in an open source project. Plus, they only offer support if you’ve purchased their SDK.
So, I’ve decided to offer free technical support to anyone using a 2413U for non-commercial purposes. If you want help with this thing, by all means, email me, post comments at the end of this post, whatever. I’ll be glad to help you.
Let’s start by linking to all the useful information about Insteon that they haven’t completely wiped off the internet (yet):
- Insteon Modem Developer’s Guide – this is for the 2412S, which is the chip at the heart of the 2413U, so it’s the bible for this device
- Insteon Command Tables – vital info about the actual inter-device commands that get passed back and forth
- Insteon Developers’ Guide – note it’s hosted at a university, not the manufacturer
- Insteon Device Categories and Product Keys – a couple years out of date, but full of great information
- Another great Insteon Device List
Now how did I find all this information? Google. SmartHome (the Insteon people) don’t seem to provide links to any of this information from their home or (non-walled) support pages, but they either let Google crawl them, or other companies or organizations have posted them on their sites (I first found the modem developer’s guide on Aartech’s site, for instance). Once you get one document, they tend to make references to the titles of other documents, so you could start to Google for the other ones by title. Basically, it was a pain, but that’s how it was done.
Now, whether you buy the 2413S (serial) or 2413U (USB), they’re both using the 2412S internally, which is an RS232 device. The 2413U just includes an FTDI USB-to-Serial converter, and you can get the drivers for this for free (you want the VCP driver). It just ends up making the 2413U look like another COM port on your PC (in my case, COM4).
So, assuming you know how to open a serial port from .NET, and you got done reading all that documentation, you’d realize that if you wanted to turn on a light (say you had a switched lamp module at Insteon address “AA.BB.CC”), you’d want to send it this sequence of bytes (where 0x means hex):
- 0x02 – start of message to PLM
- 0x62 – send Insteon message over the network
- 0xAA – high byte of Insteon ID
- 0xBB – middle byte
- 0xCC – low byte of Insteon ID
- 0x0F – Flags (meaning: direct message, max hops)
- 0x12 – Command byte 1 – means “turn on lighting device”
- 0xFF – Command byte 2 – intensity level – full on
… after which the 2413U should respond with:
0x02, 0x62, 0xAA, 0xBB, 0xCC, 0x0F, 0x12, 0xFF, 0x06
… which is essentially just echoing back what it received, and adding a 0x06, which means “acknowledge”.
At that point, the 2413U has started transmitting the message over the Insteon network, so now you have to wait for the device itself to reply (if it does… someone might have unplugged it, after all). If you do get a response, it will look like this:
- 0x02 – start of message from 2413U
- 0x50 – means received Insteon message
- 0xAA – high byte of peer Insteon ID
- 0xBB – middle byte
- 0xCC – low byte of peer Insteon ID
- 0x?? – high byte of your 2413U Insteon ID
- 0x?? – middle byte of your 2413U Insteon ID
- 0x?? – low byte of your 2413U Insteon ID
- 0x20 – Flags – means Direct Message Acknowledgement
- 0x12 – Command 1 echo’d back
- 0xFF – Command 2 echo’d back
If you get all that back, you have one successful transaction. Your light show now be on! Whew, that’s a lot of overhead though, and that’s just the code to turn on a light! There are dozens of other commands you can send and receive. I didn’t want to be bit-twiddling for hours on end, so I created a little helper library called FluentDwelling so now you can write code like this:
var plm = new Plm("COM4"); // manages the 2413U DeviceBase device; if(plm.TryConnectToDevice("AA.BB.CC", out device)) { // The library will return an instance of a // SwitchedLightingControl because it connects // to it and asks it what it is var light = device as SwitchedLightingControl; light.TurnOn(); }
I think that’s a little simpler. FluentDwelling is free to download, open-sourced under the GPLv3, and includes a full unit test suite.
It also supports the older X10 protocol, in case you have some of those lying around:
plm.Network.X10 .House("A") .Unit(2) .Command(X10Command.On);
There are quite a few Insteon-compatible devices out there. In addition to lighting controls, there is a Sprinkler Controller, Discrete I/O Modules, a Rain Sensor, and even a Pool and Spa Controller. That’s just getting started!