Software: Get Insteon / Talking to your PC – Part 2

Posted: June 20, 2008 in Software Setup
Tags: , , , , ,

Part 2.

As requested, here are some live examples,  this is of course using the SDM library in VB 2005, the same works for VB6.
Since my blog is really about my home project, a VERY GOOD site,  which is the one I used to start which has lots of specs and examples in VB6 about these commands. Its called Efundies.com, I wouldn’t like to re-invent the wheel.

My examples are using the SDM.SendinsteonRaw command, I find them faster since you don’t wait for a return.  For our examples we can use the source as “00 00 00” or the actually # on the PLC and the
rate is the actual intensity of the command. you can also use the sm.SendINSTEON(Device ID,command 1, command 2,hops) but it will wait for a reply.  I like to catch the response on the way back. And example using that command would be
sm.SetOnLevelText(“07.B1.12”, “100%”) – And here you DO have to use the dots. 🙂  A list of most of the commands that can be used when the SDM is properly load are here

We’ll use as examples for our program that the device we want to control is

In our program previously defined,
You can download the SDM device manager here.  Also some information regarding the PLC can be found here (This is the one I have) – worth every $

Option Explicit on
Friend WithEvents Sm As SDM3Server.SDM3

 Public Sub MainMenu_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
 Sm = New SDM3Server.SDM3  - Create a instance of the SDM using (SM)

 Dim Mac as string = "11 22 BB"
 Dim Rate as integer = 255

Mac = “11 22 BB”
Rate = Intensity of the device (Since we are using raw commands this runs from 0,256 and needs to be converted to HEX”
The last #3, which is the Hops= I keep as 3 (Always works for me.)

Notes: All values are in HEX, also you need to put spaces in your device address, in my case I pull them off a SQL Database but they come in as “11 22 33” if you put (.) dots or any other characters the command wont work.

Turn onSm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 11 ” + Hex(Rate), 3) – Turn on device to the desired rate to 255 is the same as Sm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 11 FF“), 3) – Turn on 100%
This will turn on the device at the predefined RAMP rate so if you have setup a slow ramp rate this is the one to use.  For example ICON Dimmers have no ramp rate (options) so this will turn on at .1 seconds

Turn on fastSm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 12 ” + Hex(Rate), 3) – Turn on device to the desired rate to 255 is the same as Sm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 11 FF“), 3) – Turn on 100%
This will turn on the device at fast redgardless of the  predefined RAMP rate.

Turn offSm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 13 00″, 3)
This will turn off the device at the predefined RAMP rate so if you have setup a slow ramp rate this is the one to use.

Turn off fastSm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 14 ” + Hex(Rate), 3) – Turn on device to the desired rate to 255 is the same as Sm.SendINSTEONRaw(“00 00 00 ” + Mac + ” 05 11 FF“), 3) – Turn on 100%
This will turn on the device at fast redgardless of the  predefined RAMP rate. For example ICON Dimmers have no ramp rate (options) so this will turn off at .1 seconds

Brighten up one step sm.SendINSTEONRaw(“00 00 00 “+Mac+” 05 15 00″, 3)
Each device has 32 levels of so this will just bump down or up one.  Good for dimming without knowing the previous value.  You can dim to 0.

Dim down one step sm.SendINSTEONRaw(“00 00 00 “+Mac+” 05 16 00″, 3)
Each device has 32 levels of so this will just bump down or up one.  Good for dimming without knowing the previous value.  You can dim to 0.

Get status of device – sm.SendINSTEONRaw(“00 00 00 11 22 BB 05 19 00″, 3)
Using Alternet command sm.GetOnLevelText “11.22.BB”

Sending a Inteson group message; Groups allow you to send messages to a set of devices (1,2,10,100,200 with one command) Only bad things is you dont get a reply from the devices
I have found I had to run this twice sometimes but (We’ll get to groups later) .

Turn off group #20 (Remember HEX!) – sm.SendINSTEONRaw(“00 00 00 00 00 20 CF 13 00″, 3) ‘ SEND broadcast group 20 OFF!

Turn on group #20 – sm.SendINSTEONRaw(“00 00 00 00 00 20 CF 11 FF”, 3) ‘ SEND broadcast group 20 ON

The PLC also send X10 commands, for this I use theSendX10 command, this command WILL pause and wait for a response. For example

Sm.SendX10(“D02,DON”) ‘ TURN ON Device D02
Sm.SendX10(“D02,DOFF”) ‘ TURN ON Device D02

Advertisements
Comments
  1. […] 2nd Part here. MORE HERE Possibly related posts: (automatically generated)Encrypt string in dotNet […]

  2. […] we start, I recommend reading the previous threads here so you know how to setup and ‘capture’ the PLC text using VB 2005.  If you new to X10 […]

  3. […] 2nd Part here. MORE HERE Posted by lgarcia4617 Filed in Software Setup Tags: Home Automation, Insteon, SDM, Smarthome, X10 […]

  4. […] MORE AND PART #2 HERE Posted by lgarcia4617 Filed in Non Insteon Programming Tags: Home Automation, Insteon, sunrise, sunset, vb 2005, X10 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s