Posts Tagged ‘groups’

Like many programs there is always more ways to do one thing.

Here is another way I found to talk to my PLC what I’ve been able to get is that i’m sending the direct HEX (PLM) commands to the PLC. Which in turn makes  the processing faster. In my environment it helped a little but had its down sides.

My initial articles using the regular Insteon commands are here.

Turn on a group (SM is your VB PLC Object) Using the PLCHEX command

Im suspecting the first HEX codes are the address and command we are sending to the PLC

Example #1,

My PLC ID is 0D.51.32
Group I want on is “1A
Groups use :C5
Command: Turn on (11=On,12=Fast On,13=Off,14 = Fast Off,19=Poll, 10=Ping)
Power:Full (The last FF for 255 HEX)

Code;

Sm.SendPLCHex("02 40 01 A1 00 09 FD CB 0D 51 32 00 00 1A C5 11 FF)
Sm.SendPLCHex("02 46 01 42 10 9F") ' - Execute Command?

Advantages is that there is no ‘sendtxt’ echo coming back or even a echo of my text going out, which for me makes the command process faster.  And you still get the ‘echo’ in the same format coming in so no change to your program is needed if you are already capturing th text comming back.

Cons:There is no place to define the HOPS?. Sometimes can fail is you send to many commands one right after the other, Im suspecting that since you we are cutting the initial ack on the start it choke after too many commands.  My solution to this was to pause between each command I sent to it.  A good 1 seconds did more than just fine.

* BTW, I like to send the group commands twice since I dont do Group clean-up’s so I basically execute the second line twice.

Turn on a single device (SM is your VB PLC Object) Using the PLCHEX command

Example #2,

My PLC ID is 0D.51.32
Device I want on is :0A.0B.0C
Single Devices use  :05
Command: Turn on (11=On,12=Fast On,13=Off,14 = Fast Off,19=Poll, 10=Ping)
Power:Full (The last FF for 255 HEX)

Code;

Sm.SendPLCHex("02 40 01 A1 00 09 FD CB 0D 51 32 0A 0B 0C  C5 11 FF)
Sm.SendPLCHex("02 46 01 42 10 9F") - ' - Execute Command?

Hope this helps in your development, and drop me a line if this helps you…

Advertisements

Here is my Christmas setup for 2008. No video yet but y I think you’ll be able to get the picture of what you can do with the LampLincs.  My setup as of today consist of mainly blue and white. I have a indoor tree and two outdoors.  Using 6 LampLincs and groups I can change the rate of the blue and white on all of them.

So I created groups which have various combinations of them.  Here are some pics;

Here the deer is set a 50%. This is just a couple of days before we set them up outside.

Here is a side view of the home.with the deers setup outside.  You can see the two outdoor trees with the two color setups.  The deers since they have moving parts and motors and other devices are on relays

Here you can see the indoor tree blue and the outdoor white.

Trees at 50/50 white and blue

All tree 100% Blue

I basically have two lamp lincs on each tree for a total of 6.  The Spots and the lights on the trunk are on Relay’s

I’ll include more of the outdoor setup so you can see how it is connected.

Some of the Lamp Linc’s ready to go outside.

If your looking to create groups using the simplehome.net 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 Simplehome.net 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. 🙂

Enjoy!

Luis


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.

HEX BRIGHTNESS
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

RAMP RATE TIME Factor
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 Simplehome.net’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)

NEAT!

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!