Posts Tagged ‘responder’

Lets say your like me and you wish to check the status of the contact on your garage.    But notice that regular polls only return the device itself not the status of the contact.

For example maybe at a given time you want to make sure the contact is closed.  Here is how

I’m going to use as reference the original articles of getting “Insteon to talking to your PC found below” Part #1,#2,

This is using VB .NET and assuming you already have some experience with the SDM/PLC commands.

For the Sensor Poll We are going to use the command #19 and a second command of ’01 to query the device.  For example

For this example Lets say for example my plc is AA.BB.CC
My I/O Linc is : 11.22.33


So in VB polling the device using the SDM would be like this,

sm.SendINSTEONRaw(”AA BB CC 11 22 33 05 19 01″, 3)

In return you will get the following bytes, notice the change in the last digit.
If the garage is closed (Contact closed)
 - 04 11 22 33 AA BB CC 25 03 01 

If the garage is closed (Contact OPEN)
 - 04 11 22 33 AA BB CC 25 03 00

If you get FF,FE or other numbers make sure you are using the last 01 on your command #19 as this will give you the state of the device which isnt the contact status.



If your looking to create groups using the utility click on the link below.

Setting up Insteon groups via software or ’soft linking’ using Simplehome.nets utility

Lets say you want to be able to link and create groups without having to use the utility, this is how its done.
Lets assume with the previous post that you already have your PLC talking to your PC so you know you can use the Intellisense in VB to see the SDM commands available

setOnLevelText=<INSTEONid>,<onLevelCmdOrValue>[,<hops>] for example

Sm.SetOnLevelText(“0D.39.61”, “10%”) or even or
Sm.SetOnLevelText(“0D.39.61”, 255)  for 100%

A good link and my reference I used to the SDM commands can be found here

Live Example

For the example let’s say you have two devices (Lamplincs, or dimmers) and want to create a group where both of them have a 19 second ramp rate and turn on 100 percent.

The first devices address is 01.02.03

The second device is 05.06.07.

Since we are using the native SDM commands we can use decimals numbers.   Here is a break down of the command / “SetupLink”

SetupLink (“<Device to Modify>” , <True for Responder / False for Controller>, <Group #>, “<My PLC Address>”, <onlevel>, <RampRate>)

<Device to Modify> would be entered with the dots and quotes, in this case “02.03.04”

<True> for Responder for both of them since the PLC will be controlling them.

<Group #>, entered in Decimal for this example we will use #34

<My PLC address>, entered the same as above, with dots and in quotes

<onLevel>, using from 0-255, 0=off thru 255 = 100% on.
<rampRate> using one of the 32 ramp rates., use the chart below, for example 31 is .1 seconds. I like to use either #23 or #24.

31 0.1 Seconds
30 0.2 .
29 0.3 .
28 0.5 .
27 2 .
26 4.5 .
25 6.5 .
24 8.5 .
23 19 .
22 21.5 .
21 23.5 .
20 26 .
19 28 .
18 30 .
17 32 .
16 34 .
15 38.5 .
14 43 .
13 47 .
12 1 Minutes
11 1.5 .
10 2 .
9 2.5 .
8 3 .
7 3.5 .
6 4 .
5 4.5 .
4 5 .
3 6 .
2 7 .
1 8 .
0 9 .

Here is the command below

Sm.SetupLink(“01.02.03”, True, 34, “0D.51.32”, 255, 23, 0)

Simple right?.  I recommend testing this with a external device jsut to be sure, the best thing of this is that when the command is executed it automatically creates the controller link on your PLC, so basically you dont have to do anything else!!  When you run the command make sure you dont have other stuff going on, like motion sensors, X10 data, it tends to not act nice.  If you look at the data comming in you will see a confirmation string at the end like this.

7/1/2008 8:30:49 PM receiveinsteonraw=04 01 02 03 0D 51 32 22 2B 17
7/1/2008 8:30:50 PM setupLinc=true,01.02.03,34,0D.51.32,1,255,23,C,0xA2,0,08.B6.6C[7]0x0FC8,[0]0x0000

and our set, now if we want to setup the second one we do the same thing but change the first address. Like this,

Sm.SetupLink(“04.05.06”, True, 34, “0D.51.32”, 255, 23, 0)

Now using our group commands both will turn on at the same time using the defined ramp ramp to the specified value, But you can define different ramp rates and on levels to different device on the same group have a really neat effect, if that is what you want.  For example you can have two devices on the same group but one with 50% on and the over 100% and  with one command you set up a scene!!! neat!.

Here is the command I use to turn on group #34, since im using the sendtext to the SDM directly the values will need  to be entered in HEX for #34 is the equivalent to #22.

Sm.SendINSTEONRaw(“0D 51 32 00 00 22 CF 11 FF”, 3) ‘ sEND broadcast group 17 ON!

#22 is the equpvalent of #34 in Hex and you already know #11 is the on command, to turn off its #13,  You can see a breakdown of the commands here. You can brighten, dim all the devices at once also!!

Only down side of the groups is that you wont get a feedback on the individual devices. So you may need to poll them individually.

Before you ask, yes there is a way to confirm the record was created but that will be for another post. 🙂



One of the best devices that I like which is included with the Starter kit is the ControlLinc.  This little device contains 5 set of buttons which dim,brighten and do other wonder things.  But after a while I wanted to have one button to run my ‘end of day’ scripts.   So after poking around I found how to catch which button was pressed this way you can setup your on or off button to various functions, basically doubling the options on my device.

Here is how one of my devices look.  Sorry Im still working on the insert.

So now instead of only 5 (on/off buttons) I have a combination of on/off’s as well as toggle (on/off) 🙂

As mentioned in my previous blog, the idea is to catch the data and act upon it.  Here is a copy of the code i used today to trap the OnText events that come in from the Insteon device. You can see by depending on the CMD1 you can catch by ON/OFF/Fast ON/Fast OFF.  so basically we are going to trap when a OFF button is pressed and then capture which button is pressed and act upon it.

Remember you will need to link your controller with your PLC to work, even if your PLC wont turn anything on or off you still need it for your code to see the commands coming in. You can do this by using the TAP/TAP method or doing it by Software linking shown here.

The variable Addrfrom will hold the address of your Controlinc
The variable AddrTo will hold the address of your PLC
The variable CMD1 will hold the function (on/off/dim/etc)
The variable CMD2 will hold the button that was pressed for example 01 = 1st set of buttons,02,03,04,05 etc.
So for the example below lets say we want to capture the ‘END OF DAY’ button, which is the third ‘OFF button, from left to right. Pressing a OFF button will send
a command of #13 which will then call the function below and check for which Key (1-5) was pressed

The code below is the same I explained in the Software: Get Insteon / Talking to your PC – Part 2 & Software: Get Insteon / Talking to your PC – Part 1

A sample string coming in would look like this;

6/28/2008 8:55:18 PM receiveinsteonraw=04 01 02 03 11 22 33 11 03 ‘ This is a ON button #3 pressed
6/28/2008 8:55:18 PM receiveinsteonraw=04 01 02 03 11 22 33 13 03 ‘ This is a OFF button #3 pressed

Like mentioned before starting from the left to right, Hex values

04 ? Sorry – don’t know

01 02 03 is the ID of the ControlLinc

11 22 33 is the ID of my PLC

13 is the OFF command

03 is which key was pressed from left to right.

I just added to the checking of the ‘OFF’ button and expanded from there.

Public Sub sm_OnText(ByVal strInsteonStatus As String) Handles Sm.OnText
        Dim device, bytes, data
        Dim Group As String
        Dim var As System.Array

        Dim value, Addrfrom, Addrto, flags, Cmd1, Cmd2 As String
        var = Split(strInsteonStatus, "=")
        Select Case LCase(var(0))
            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)
                    Cmd1 = bytes(8)
                    Cmd2 = bytes(9)

                    ' ------------------------- MACROS FOR REGULAR ON (11)
                    If Cmd1 = "11" Then
                         Macro_Check_Btn_On(Addrto, Addrfrom, Cmd1, Cmd2, flags)
                    End If
                    '-------------------------- MACROS FOR DOUBLE ON (12)
                    If Cmd1 = "12" Then
                        ButtonsChanged = True
                        Macro_Check_double_On(Addrto, Addrfrom, Cmd1, Cmd2, flags)
                    End If

                    ' ------------------------MACROS FOR 'Off' command checks (13)
                    If Cmd1 = "13" Then
                        Macro_Check_Btn_OFF(Addrto, Addrfrom, Cmd1, Cmd2, flags)
                        ButtonsChanged = True
                    End If
                    ' ----------------------- MACROS FOR DOUBLE turned off (14)
                    If Cmd1 = "14" Then
                        Double_Turn_off(Addrto, Addrfrom, Cmd1, Cmd2, flags)
                        ButtonsChanged = True
                    End If
                End If
        End Select

 Public Function Macro_Check_Btn_OFF(ByVal Addrto As String, ByVal addrfrom As String, ByVal command1 As String, ByVal command2 As String, ByVal Flags As String) As Boolean

        If addrfrom = "010203" And Addrto = "112233" And command1 = "13" And command2 = "03" Then
            Endofday() ' Do my special functions!

        End If


Insteon is great and is extremely fast when turning on / off devices, but lets say you want to turn on 10 lights all at the same time?

This is what they call groups. Groups allow you to store in each individual device settings such as turn on, ramp rate commands, for a specific group #.

Let me give you a example,  Let say you want to be able to turn on all your master bedroom lights with one command.  What we would do is create a group number and all the devices which will be affected will have this same number and respond as (Responder) to the person sending the command.  Don’t worry its easier than it sounds.  Let me go thru the basics and you’ll see how its done.

First for starters easiest way is to use some sort of spreadsheet, place all your device from left to right and then fill out what you want to turn on.  Here is a example (I’ll explain what the numbers mean shortly).  This way I know what group will do what and who will be ‘affected’.  Then its very easy to program going down the list.

In my case I have for example, Group #15 (Its HEX) called “End of Day” and what it does is turn off all lights but and turn on the kitchen sink all with one command.  So I mapped out all my devices and put how they are to be affected.

On Level

As you can see my values are two sets of numbers (I’ll select #15 the 2nd value of (FF/1B)

The first stands for the OnLevel (In the case of the dimmers (0-100%) but note its a HEX value, and it runs from 0-255.  Here is a quick list which I use.

FF 255
F0 240
DC 220
C8 200
BE 190
B9 185
AF 175
A5 165
9B 155
8C 140
78 120
64 100
50 80
4E 78
4D 77
4B 75
3C 60
1E 30
00 0

This way if I want to do a 50% I would use the A5 value, since im using FF it stands I want full blast, 100%!.

You will have to play with these to get the best ‘setting’ for your environment.

You can set a device to turn on to a 0% value which is the same as off, for example I have a group setup to turn on the sink night light but all other devices in the group are set to a ONVALUE of 0! NEAT!.  But OFF is OFF, no mater what you set it to.  You can see the VB samples below.  Basically the commands are the same instead of calling a device you call a group.

So with group #15 you can see the first value of all the devices is 00 with the exception of the kitchen sink which is FF so when the group command is sent all devices are dimmed while the Kitchen sink is turned on, all at the same time, the effect is very cool.

Ramp Rate’s

The second value is the RAMP rate (This only applies to devices which can ‘DIM’, and sadly its not included on the ICON dimmers, this is one of the reasons of the price difference.) These special devices have 32 levels of Ramp rates, from .1 second (which is what it is on the Icon dimmers, to 9 minutes!!)  Here is the conversion of the HEX value to the RAMP time

1F 0.1 Seconds
1E 0.2 .
1D 0.3 .
1C 0.5 .
1B 2 .
1A 4.5 .
19 6.5 .
18 8.5 .
17 19 .
16 21.5 .
15 23.5 .
14 26 .
13 28 .
12 30 .
11 32 .
10 34 .
0F 38.5 .
0E 43 .
0D 47 .
0C 1 Minutes
0B 1.5 .
0A 2 .
9 2.5 .
8 3 .
7 3.5 .
6 4 .
5 4.5 .
4 5 .
3 6 .
2 7 .
1 8 .
0 9 .

So a value of 1F is instant on, a value of 0C is 1 minute, and a value of 08 is 3 minutes!!!  The effect is awesome!  Note that once you send the command to the device to turn on with a specific RAMP rate it will go on its own and you can send more commands to other devices… NEAT!  Better yet you can have different device in the same group with different ramp rates. You know where im going with that!!  What i’ve read on the post that a slow ramp rate will prolong the life of certain lights, in my case all are CFL’s so I only use RAMP rates for external decorations and maybe a light or two.

Lets setup a group!

Lets show you some screens so you can see how its done.

Like all other things Im suspecting there are other ways of doing this, but this the way ive learned to do it and has always worked for me.

  1. Download’s program which you can find under my “Programs to have” and install it.  Im suspecting its free since its right off their support page. Once installed go ahead and fire it up.
  2. I’ve found that the program works better if there isnt any activiting on the network, also if my dryer isnt ok. Lol,. So please disconnect any X10 transievers or other information which may confuse the program.
  3. Since the utility is used to program many devices lets make sure we select that we are programming our PLC, select the USE PLC followed by ‘Connect’
    If you get an error, make sure you SDM driver is loaded, it should load automatically if not. This is also available from the ‘Programs to have’ page.
  4. Select the “Manage Device Links”
  5. Now hit your caps lock as all values need to be capital and the devices ID need to have (.) between them, like in the sample.  (Here we go!)
  6. In the first red square you will be entering the device you want to control (or in this case add to the group)
  7. In the green square, we need to add what device will be controlling it or responding to it.  If the device is going to respond its command we would select ‘Responder Below’, so this means when I call the group command from the device in the green box, the device in the RED box will respond.  In the case of a Controller its backwards.Since Im using my PC to send out group commands, we can assume that the ‘Second Insteon ID’ field will always be my computer PLC address.  This of course can be any other item, this way you can have one device control another or vice-versa!   In the case of 3 way switches this is where you would have two entries on both devices, and each is a responder and controller of each other!!
  8. In the Yellow box is where we 1st define the On Level (In HEX) , followed by the 2nd box contains the RAMP rate, 3rd box .
  9. Enter a group number in HEX.
  10. The last option as mentioned before its a responder or controller.  For the sake of this example its Responder.
  11. Hit the ‘Create New Link’

11. And your SET!.

Now from your Code you can send a group ON command and watch the magic happen.  Here is example using the SendInsteonRaw command to turn on group #16

Sm.SendINSTEONRaw(“0D 51 32 00 00 16 CF 11 FF, 3) ‘ sEND broadcast group 16 ON (Command is #11)

Sm.SendINSTEONRaw(“0D 51 32 00 00 16 CF 13 00, 3) ‘ sEND broadcast group 16 OFF! (Command is #13)

Check out more commands here

Just replace the MAC address with the group number and presto, you can DIM you whole house, For example

Sm.SendINSTEONRaw(“0D 51 32 00 00 16 CF 16 00, 3) ‘ sEND broadcast group 16 DIM!  (Command is #16)

Sm.SendINSTEONRaw(“0D 51 32 00 00 16 CF 15 00, 3) ‘ sEND broadcast group 16 Brighten!  (Command is #15)


There is a catch to group commands, that they WONT RETURN THE STATUS OF THE INDIVIDUAL ITEMS,  you will only get a response that the command to the group was sent successfully.  In my case I usually send the command twice to make sure they all are hit. 🙂

The first 3 sets of digits are my PLC, the next three are the group number

CF = ?

11 = the On Command

FF = the On Value

Like mentioned before, depending on your device and your RAMP rate settings the device will fade on, ICON switches will just jump to the level you have then set to.

For my program I have groups setup for

  1. Turn on/OFF all house lights
  2. Turn on/off both children’s room
  3. Turn on/off all external/indoor decorations
  4. Turn off all bathroom lights
  5. Turn off all lights but turn kitchen sink on
  6. Movie scenes Dim lights etc.
  7. Turn on/off all fans (We’ll get to that later using the Inline Linc’s)
  8. The sky’s the limit

You are of course limited to the amount of groups, depending on the device, for example the ICON’s will hold less groups but I doubt you’ll use them all.  🙂

Using this program is where I also link the device to the PLC so I can catch the commands coming in if I cant use the TAP/TAP method, for example I want to see when someone turns off a device, I would do everything the same except I would select ‘Controller’.  Even thought the switch really doesn’t turn on anything on my PLC I need to have that ‘group’ setup so I can capture it in my  code. 🙂

Good luck!