Posts Tagged ‘’

Hurray, My I/O linc arrived on Saturday 10th!!!

The good news is that its setup and in place.  Setup was a breeze since I’m literally replacing two X10 products for one.  I love it!

So the wiring is the same

Here is my Garage contact I purchased separately before, now as part as a kit.


Since the top part is so light I ended up using Velcro so I didn’t need to drill holes.

Now the I/O Link

Here are the official instructions

As for the hook-up its very straight forward and the on-line manual has a very good description of this.  My recommendation is use the individual strands of a CAT 5 cable, they fit perfect.

Here i’ve connected in my garage door sensor. (Click to magnify) – Green cables

Below I’ve connected my ‘momentary’ switch to the back of the garage opener. (You do have to setup your I/O linc to do the momentary relay before which is the “C” setup).

This is done by pressing the ‘SET” button 3 times x 3 times for a total of 9 times. Double check on-line just to be sure.

Orange is my Open/Close wires to the Garage and the green are my sensors

Here is the box setup next to the Garage opener.  Since there is no space for the I/O linc I had to set it up next to the opener.  Plus I didn’t want to put it flush with the device since it vibrates a lot.

Now each time the device Open’s I get the “11 FF” message and when it closes the “13 FF” message. But i still haven’t figured out
how to read the sensor yet.  Once I get those details I’ll post part 2.

Here is how the linking process works.  It’s done both ways (like a 3-way switch)

* If you want to monitor the garage  status AND use a keylink button you NEED to link then both ways,

1.First open your garage door.

2.Starting linking your I/O link to the KeyLink Key or switch have the switch control your garage then Link Keylink key and then then I/O.

4. This way when you press the key it open/closes as well as the button lights up when you open the door and close it. 🙂

Here are the official instructions

Hi, in a previous article I had shown how to monitor & capture data on a specific port using VB. Mainly to allow my server send out notification to the clients, like a Caller ID Alert. That article can be found here

How to monitor and capture data in a specific port in VB / 2005

Below I’ll show the code I use on the server side to actually open and send the information to the clients.

Like mentioned above I will use the example of a caller Id alert , so the program will open a port 81 and send the text ‘callerid’ to the clients (In this case You can use PC names if you have a home router like D-link etc.

Since I have a couple of clients I use VB ‘commandline’ feature to retrieve the IP, port and message that I am going to send.  My utility is called ‘BumpClients’.  For the example lets say this how its called

“Bumpclients.exe callerid 81”

—————— Setting up the imports, make sure you include System.Net and, the others may not be needed

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports System.Xml.XPath
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Data
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1

'------------------------------ Create the instance to of the TCP Client (Its the same as receiving)
    Public WithEvents OpenPort As TcpClient  

'------ I use the Form_load event to quickly send the message and exit the program, no user interaction is needed, we grab all paramters from the command line when called.
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Minimized '- Go hidden
        Me.Hide() '- Go hidden

'------ Next using the Split command I grab the three parameters by looking for the space( This will give me the IP,the command,and port the program will use!)
'------ Data(0)=IP, Data(1)=command, Data(2)=port.

        Dim IP As String
        Dim datA_out
        Dim port As Integer

        data_out = Split(Command$(), " ")
        IP = data_out(0)
        port = data_out(2)

'------ Just a quick check to make I can ping the IP, if not just exit and dont even bother.
        If My.Computer.Network.Ping(IP) = False Then End

'---- The actualy opening of the port un a 'try' statement if it fails exit also
            OpenPort = New TcpClient(IP, port)
        End Try

'------ If all is good then go ahead and convert our text to bytes and send it out using the stream method!
       Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(Trim(data_out(1)))

        Dim stream As NetworkStream = OpenPort.GetStream()
        stream.Write(data, 0, data.Length)

'------ Close and exit!- That's it!
    End Sub
End Class

A important note, remember that on your client you need to open the port you use in the firewall or it will never see anything, but you dont need to open it on the server since it will be sending.  To test this you will need the two actual computers sine you cant monitor and send data thru the same port.

In my application I actually run a external program using the system.diagnostics,process.start command, to the IP of my PC’s this way, it will run each script and not wait.And each of time will exit accordingly.


System.Diagnostics.Process.Start(“C:\vb\Insteon_BumpClients\BumpClients\BumpClients\bin\Release\BumpClients.exe”, ” ” + data_out + ” ” + port) ‘ Laptop
System.Diagnostics.Process.Start(“C:\vb\Insteon_BumpClients\BumpClients\BumpClients\bin\Release\BumpClients.exe”, ” ” + data_out + ” ” + port) ‘
System.Diagnostics.Process.Start(“C:\vb\Insteon_BumpClients\BumpClients\BumpClients\bin\Release\BumpClients.exe”, ” ” + data_out + ” ” + port) ‘


In one of my  previous post I had shown how to capture the Caller Id info of a modem.  So what do I do this the information??

In my case I notify all the PC in the house a particular caller / number is ringing by sending data on a specific port.  So they know who it is before picking up or even looking at the phone for the caller Id info. Below is the code on how to monitor a port for data.

In this case it will open and monitor port 81.  Since there is no event for the TCPListener Im using the VB timer control, then check the port for any pending data ever 1000ms , if data is pending it will read it and show it in a pop-up in the icon tray. 🙂

To keep it simple here, and Not shown here, I actually FTP back via code (Will setup another post for this) to the server and grab the image of the person which is then displayed on the client on another window.

Like all code here, is all in VB 2005. For setup: Note that for this  to work you do need to open port 81 (TCP) on the client.

Just create a basic form with the following controls (All are default names)

A Notify object called “NotifyIcon1”
A timer object called “Timer1”

‘—————— setup my Import variables, some may not be needed.

Imports System.Web
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System
Imports System.ComponentModel
Imports System.Threading
Imports Microsoft.VisualBasic

'----------------------- Here is the main class which loads the form.
Public Class Form1
    Public WithEvents OpenPort As TcpListener '--------- I setup the TCPListner object, There really isnt no events for it so I have to check using a timer.

'--------- GET THE CLIENT ip FROM THE ENVIRONMENT This will return ina array the IP of the client in the case of XP the first ip(0) should be fine, in the case
'--------- vista you have to search for it. I just looked for the first octet to be the same as my internal network.

    Public ip() As System.Net.IPAddress = System.Net.Dns.GetHostEntry(Environment.MachineName).AddressList
    Public IPAdresstxt As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'ip(0) = IPAddress.Parse(Microsoft.VisualBasic.Interaction.Command()) '---- Un-comment for XP

'------- for Vista the first item of the array can be anything, so I loop thru the values looking for the same network of my home network
        Dim ip_count As Integer
        or ip_count = 0 To ip.Length - 1
            If ip(ip_count).ToString.Contains("192") = True Then
                OpenPort = New TcpListener(ip(ip_count), 81)  '--------- Here we set the IP (My PC) and the port to monitor in this case 81
                IPAdresstxt = ip(ip_count).ToString
            End If

        OpenPort.Start() ' - Open and monitor
        NotifyIcon1.Visible = True
        NotifyIcon1.BalloonTipTitle = "Caller ID"
        NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
        NotifyIcon1.BalloonTipText = "Caller ID Running, window will close in 3 seconds"
        NotifyIcon1.ShowBalloonTip(2500)  '----------------- Hide my Icon popup after 2500 MS
        Me.Hide() '----------- This will hide my form and only leave the icon on the tray.  :)

    End Sub

'------------------ This is my main timer1 which is enabled and checked every 1 sec.
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        '-------------- CHECK PORT 81 IF GOT DATA
        If My.Computer.Network.IsAvailable = True Then  '----- If data is present then read data and pharse it.
            If OpenPort.Pending = True Then
                Dim bytes(1024) As Byte
                Dim data As String = Nothing
                Dim client As TcpClient = OpenPort.AcceptTcpClient()
                Dim stream As NetworkStream = client.GetStream()
                Dim i As Int32
                ' Loop to receive all the data sent by the client.
                i = stream.Read(bytes, 0, bytes.Length)
                While (i <> 0)
                    data = data + System.Text.Encoding.ASCII.GetString(bytes, 0, i)
                    data = data.ToUpper()
                    Dim msg As Byte() = System.Text.Encoding.ASCII.GetBytes(data)
                    i = stream.Read(bytes, 0, bytes.Length)
                End While

                data = LCase(data).Trim
                ShowCallerID(data)  '---------------------- Call the function to update the Notify-Icon
                Msgbox "Data received is"+data
         End If
        End If
    End Sub

'---------------------- Function to update the Notify-Icon
    Public Function ShowcallerID(number as Integer) As Boolean
        NotifyIcon1.BalloonTipText = "Incomming call from " + name + vbCrLf + " From # " + number.ToString
        IncommingCallWindow.txtName.Text = name
        If number.ToString.StartsWith("1") = True Then
            number = Val(Mid$(number, 2, number.ToString.Length - 1))
        End If

    End Function

End Class