Ok, Ive got switches turning on and off, but I want more!. More googling and browsing around the sites I found that there is even devices to talk and read what the insteon network is doing. This is also available for X10 but what really interested me was the ability to get the status of the device, for example when you turned it on, you can get a confirmation that it really was received and really ‘on’.? After saving up a little I ended up purchasing the serial interface. They come also in USB and even modem versions. But what interested me was I like to be able to get the direct connection with the device and bypass all the usb stuff plus I had the ability to download ‘timers’ if the PC wasn’t going to be used all the time. Below is a picture of the unit. It includes all the necessary hardware. including the rj45 to serial cable.
The best part is you can download the PC software (referred to as SDM) , and all is done thru COM objects. The way COM objects work is that you can reference the device by any programming language it and it automatically sorts strings back to you (In a sort of way). A very good site which has even examples that got me started can be found here. I’ve even posted some of the code below which I expanded for VB 2005 so I’ll put some example referencing the object. It you look at any of the switch and even the external ones you’ll see the 3 Hex characters, each unique to each device. So once you start see the data flow you will see these addresses inside of them, some as responding and some as replying. Once you plug in the code you will see what I mean, I have found using a excel sheet to keep all these addresses makes like much easier.
1st you Google “Smarthome SDM” and you’ll find direct downloads to it. Its a regular windows install package
2nd Reference the object in your program, its called ‘Smarthome Device Manager’
3rd Add to your code to reference it as well as to be able to catch the events, example
Friend WithEvents Sm As SDM3Server.SDM3
When I load my mainmenu even I have the following
Public Sub MainMenu_Load(...... ) Sm =New SDM3Server.SDM3
Try Sm.IsResponding() Catch MsgBox("SDM NOT LOADED try AGAIN") End Try
Now you can catch events from the device, the main event to catch and look for is.
Public Sub sm_OnText(ByVal strInsteonStatus As String) Handles Sm.OnText
var = Split(strInsteonStatus, "=") Select Case LCase(var(0)) Case "setonleveltext" data = Split(var(1), ",") device = data(0) value = data(1) Case "receiveinsteonraw" data = var(1) bytes = Split(data," ") If LBound(bytes) = 0 And UBound(bytes) = 9 Then AddrFrom = bytes(1) & bytes(2) & bytes(3) AddrTo = bytes(4) & bytes(5) & bytes(6) Flags = bytes(7) Command1 = bytes(8) Command2 = bytes(9) If AddrFrom="05BBAF" And AddrTo="05FB8E" And Command1="11" Then MsgBox "Received Button 4 On" ElseIf AddrFrom="05BBAF" And AddrTo="05FB8E" And Command1="13" Then MsgBox "Received Button 4 Off" End If End If Case Else End Select
This will bring back all the sent,received strings, you later then have to sort them out.
I used some of the previous mentioned wepage’s code and expanded from that.
Best way is to watch the strings go by.Here is a pic of mine installed and ready to go.
* Note that you do need to ‘link’ the switches to your PLC or computer interface, even though you aren’t really turning it on but its the only way I was able to get it to see the commands.
Here are some examples (Lets say a switch has the id AA.BB.CC and my PLC (Computer interface is ) “11.22.33”
#receiveinsteonraw=02 AA BB CC 11 22 33 45 11 01 —- device acknowledging its been turned on (Notice 11 for on)
#receiveinsteonraw=02 AA BB CC 11 22 33 45 12 01 —- device acknowledging its been turned on double pressed up(Notice 12 for FAST on)
#receiveinsteonraw=04 AA BB CC 11 22 33 25 13 00 – device acknowledging its been turned off (notice the #13)
#receiveinsteonraw=04 AA BB CC 11 22 33 25 14 00 – device acknowledging its been turned off with double tap down (notice the #14)