Insteon Programming PLM Basics X10  PLM Receiving Insteon Commands Ramp Rates Devices i2cs  Deus Ex Machina

Controlling Devices via the PLM

The PLM uses a serial port connection to your computer, so the first step is to add a SerialPort control to your form. Set the parameters as:

BaudRate = 19200
DataBits = 8
Handshake = None
Parity = None
PortName = whatever Com port you are using (e.g. "COM1")
StopBits = 1

I called mine "SerialPLM"

These examples assume the Insteon address of the device to be controlled is in a string called Address, in the format "0E.A2.10".

To turn an Insteon device on:

Dim data(7) as Byte
Dim a() as String

data(0) = 2  ' all commands start with 2
data(1) = 98 ' 0x062 = the PLM command to send an Insteon standard or extended message
a() = Address.Split(".")
data(2) = Convert.ToInt32(a(0), 16)  ' three byte address of device
data(3) = Convert.ToInt32(a(1), 16)
data(4) = Convert.ToInt32(a(2), 16)
data(5) = 15 ' flags
data(6) = 17 ' 0x011 = the Insteon command for "On"
data(7) = 255 ' 0xFF = 100%    -- to change the level up or down, just replace this value
SerialPLM.Write(data, 0, 8)

To turn an Insteon device off:

Dim data(7) as Byte
Dim ia() as String

data(0) = 2  ' all commands start with 2
data(1) = 98 ' 0x062 = send an Insteon standard or extended message
ia() = Address.Split(".")
data(2) = Convert.ToInt32(a(0), 16)  ' three byte address of device
data(3) = Convert.ToInt32(a(1), 16)
data(4) = Convert.ToInt32(a(2), 16)
data(5) = 15 ' flags
data(6) = 19 ' 0x013 = the Insteon command for "Off "
data(7) = 0 ' 0x00 = 0% the level is always 0 for Off
SerialPLM.Write(data, 0, 8)

To send any other Insteon command:

Just use the above code, except that
data(5) = flags (see below)
data(6) = command1 (click here for a reference list)
data(7) = command2

The flags byte most often will be 15, which means it is a direct message to the addressed device, and should be retransmitted by other devices along the way 3 times. The breakdown of the flags byte in detail is:

Bit Position Flag Meaning
Bit 7 (128) Broadcast/NAK 100 = Broadcast Message

000 = Direct Message
001 = ACK of Direct Message
101 = NAK of Direct Message

110 = Group Broadcast Message
010 = Group Cleanup Direct Message
011 = ACK of Group Cleanup Direct Message
111 = NAK of Group Cleanup Direct Message
Bit 6 (64) Group
Bit 5 (32) Acknowledge
Bit 4 (16) Extended 1 = Extended Message
0 = Standard Message
Bit 3 (8) Hops left 00 = 0 message retransmissions remaining
01 = 1 message retransmissions remaining
10 = 2 message retransmissions remaining
11 = 3 message retransmissions remaining
Bit 2 (4)
Bit 1 (2) Max hops 00 = do not retransmit
01 = retransmit this message 1 time maximum
10 = retransmit this message 2 times maximum
11 = retransmit this message 3 times maximum
Bit 0 (1)

For example:

Direct Message, Standard length, 3 message retransmissions remaining out of 3
00001111 binary = 15

Broadcast Message, Standard length, 3 message retransmissions remaining out of 3
10001111 binary = 143