Archive for July, 2008

Here are my screens so far.  As you can see there is now text that is dynamically populated.
I picked a relative small window, in this case 574.1 x 430.05 and work everthing in that, cleaner and simple.

The Jukebox function basically tells my server to open a HTML page and play a radio URL.
you can find that article here Software:Play WAV,MP3 and Playlists, from your program.

Master Bedroom Screen, I’ve added little dots next to the devices to see if there on or off.
I show how I did this in the next article.

Here I’ve also populated the bottom of the Den,Hallway with the motion sensor data, this way
you can see when there was last activity, also the bulbs show the light status.

Yep, the notification screen, its the only way to unglue them from their PC’s
I wonder where they got it from.  That is done

The Special Features menu.  Also populate the information for the Garage Motion sensors and last time it was opened.

Another day another dollar.  Now that im working with flash and I recommend the same, that you get yourself the right tools to work with the images.
It’s all about the images and the presentation.

For creating my main images I used Corel’s PhotoImpact, before used to be owned by Nova development, it has all the goodies you want in a non-photoshop environment.  Plus I find PS to hard to grasp for the regular day to day task.
And you CAN import photoshop files and add-ins so its a real treat plus it loads faster. 🙂

Also another really good utility is one called Xnview located here
http://pagesperso-orange.fr/pierre.g/xnview/enhome.html
.
Free, Has all the goodies you want in a graphic convert, view and even rebuilds your thumbnails file when its getting slow or corrupted.  There is even a XP shell for it,highlight the images right in your explorer window and from there convert them!.There is also a external program which great features but is a little quirky when using .PNG files.

Also if you take a lot of pictures and find it a pain to be resizing them you can download this free tool,
and just by dropping your file or folder over the file it will do the magic.

http://www.rw-designer.com/picture-resize.
free, It contains many options such as replace in place or create new file, resize and keep certain degree of quality, and much more, and the cool part is that its all done by the filename.

As for Icon’s and other goodies surf the web, all the one’s ive used are free.

I have to let my ‘Vista’ rant out, here is my situation, my Main server is on a wireless PC running XP (Hopefully I can migrate to the main server).

But a Vista PC for some reason cannot ping or see it after some time has passed, note that it does respond as long as it its connected, but then just dies?

The only way to fix this is if I ping the vista PC from my XP client and then it works again!!?   And there are two other XP clients wireless also and they work fine!.

I’ve disabled firewalls, IPV6, Aegis and all the other stuff in my network settings…

Oh well I figure a work around somehow…. 🙂

Here’s a pic of my Trusty Icon Applicancelinc and Eagle Eye motion sensor…

I’ve moved that page to the Main Page since I update it frequently.

That page has been moved here

If you like me you really don’t need to know when its dusk and dawn, especially if your getting your sunset, sunrise information daily from the Internet.  Also the Eagle eye will transmit this on the next unit #. For example if you have it configured for A1 it will transmit dawn and dawn in A2, which is really a wasted slot in my opinion, also each x10 transceiver can catch 16 devices which are eaten up fast if you have a couple of the devices already.  Also in my case I have a motion sensor in my entrance that will fire a dusk/dawn alert each time the light goes on.

By using a small little black tape you can disable it.  Yes you can do this by the buttons but this is just another way of doing it. 🙂

The process involves opening the device so your on your own. Im not a expert so again its it to you.

1. Flip the device on its back, you don’t need to remove the batteries

2nd Unscrew all 4 of them and you will see the front cover pop-out

3rd You will see the dusk/dawn sensor right next to the motion sensor. What we will do is just put a small little black tape over it. I’ve

circled it in red.

4. this is how it looks with the tape covering it.  Make sure not to cover the sensor.

Close and your ready to go!!!

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 192.168.0.106). 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 192.168.0.106 callerid 81”

—————— Setting up the imports, make sure you include System.Net and System.net.Sockes, 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
        Try
            OpenPort = New TcpClient(IP, port)
        Catch
            End
        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!
        stream.Close()
        OpenPort.Close()
        End
    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.

data_out=”callerid”
port=81

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

Enjoy!

Here are some images I just took of a SwitchLinc installation, the same applies for all others such as Keylincs, Icons Relays, Dimmers etc.

Like the manual you have to identify your Neutral, Hot or Line, and your Load.

The cables on the switchlinc are clearly identified. with labels and by color,

White = Neutral

Black = Line or HOT

Red = Load

Bare = Ground.

I ALWAYS turn off the breaker and make sure non of the switches im working on work. I’ve gotten many zaps as a kid and there not fun.

Before I start I make sure I write down the address, this way Im not looking for it and removing work already done.,

Also make sure the switch is setup the upwards, the address should be on the bottom left side (At least for the switchlincs and Icons). Icon switches will have their LED on the left side of the switch.

Below is a picture of the device connected

To Identify the cables I usually look for the big bundle of for Neutral and the Load.  If its the first Insteon device you plug in you will see that neutrals not connected to any switch.
For example you can see the Neutrals are all together in the white bundle with the Red Cap,  The load or Hot is usually another bundle of black cables (This is what provides power to all switches so usually all the blacks to/from the switches die here

And the load (Which is off to the light is usually alone or going out. is the one towards the light fixture. In this case its a black wire.

The ground is the bare cable ground, that’s a easy one.

Here is a image of the finished product, this is

2 ICON Dimmers, one regular Decora on/off switch and a Switchlinc, and a unfinished painted wall.

Here is another 4 gang which is 1 Icon, a Switchlinc Dimmer, regular switch and another SwitchLinc

Cheers!

For my voice mail / Caller-ID function I placed the name / number of the person in a database but also I have the name of my contact (joe.png, luis,jpg etc), After Ive retrieved the information, I FTP back to the server to grab the image file

Here is how its done.

For the example;

FTP server is at 192.168.0.101

username is :webuser
password is :password
File to get: <variable called ImageName> in a folder called Images
Location to save: c:\images\<ImageName>
The default folder on my server have a folder called images/

On the server im running FileZilla FTP Server (Free)

'------------------------------------------------------------------------------

Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Public Function GetFTP(ByVal ImageName As String)
        Dim localFile As String = "c:\images\" + ImageName
        Dim remoteFile As String = "/images/" + ImageName
        Dim host As String = "ftp://192.168.0.101"
        Dim username As String = "webuser"
        Dim password As String = "password"
           '1. Create a request: must be in ftp://hostname format, 
            Dim URI As String = host & remoteFile
            Dim ftp As System.Net.FtpWebRequest = _
            CType(FtpWebRequest.Create(URI), FtpWebRequest)

            '2. Set credentials
            ftp.Credentials = New _
            System.Net.NetworkCredential(username, password)
            '3. Settings and action

            ftp.KeepAlive = False

            'we want a binary transfer, not textual data
            ftp.UseBinary = True

            'Define the action required (in this case, download a file)
            ftp.UsePassive = False
            ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
           'Loop to read & write to file

            Using response As System.Net.FtpWebResponse = CType(ftp.GetResponse, System.Net.FtpWebResponse)
                     '-----Setup Response stream to grab the FileStream aka Data and send it to a file using the FileStream object.
                Using responseStream As IO.Stream = response.GetResponseStream                         
                    Using fs As New IO.FileStream(localFile, IO.FileMode.Create)
                        Dim buffer(2047) As Byte
                        Dim read As Integer = 0
                        '-----Once Data is detected in the ResponseStream Loop until empty,
                        Do
                            read = responseStream.Read(buffer, 0, buffer.Length)
                            fs.Write(buffer, 0, read) '----- Write the 'read' variable into the file
                        Loop Until read = 0 

                        responseStream.Close()
                        fs.Flush()
                        fs.Close()
                    End Using
                    responseStream.Close()
                End Using
                response.Close()
            End Using

Exit function

PRESTO!

The following is a example of how I setup to control my garage door using simple X10 devices.  When budget permits I’ll bump up to the Insteon (sniff, sniff)), For this device to work I was lucky the circuit the garage door opener is on is close to my insteon/x10 PLC so I get a good 95% hit rate (Which is OK for me..)

For this to work, basically what I am doing is closing two of the three connectors of my garage door opener, this is the same thing the button on the wall button does. Red is the power going out, the white is the common ground and the grey or black is the motion sensor which will stop the door if the infrared device is passed.  I used some simple cat 5 wiring.

To do this I used a X10, Universal Module which is very cheap (Some under $15 off ebay). Picture below,

To simulate the button, this device will close a circuit momentary (2 seconds actually), you can even set it to sound when activated.
Basically sending a X10 “ON” code it will close the circuit and open or close the garage.  I’ll post another entry on how to check if the garage door is open or closed but we will be using another device.

Setup

So I set the Unit code to something not accessible thru the outside, same as the House code, the the first switch to Momentary, and Relay only. Here is how it looks

So thry my code using the SDM module , VB code I send the Open command (Lets say G16),  The system wont give you a status if it opened it or not, also only “ON” command will work.

Sm.SendX10("G16,GON")

To setup the SDM in the VB 2005 environment you need to check out my previous article. Basically here im just using the SDM COM object to send a X10 command.

That article can be found here
Software:Get X10 data to your PC using a Insteon PLC

Pros: Simple cheap

Cons: No way to know if the garage is open or not, this just simulated pressing the button

Here is everything hooked up,

Here is another picture, of my attempt to make it look better.

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
        Next
'-------------------

        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
        NotifyIcon1.ShowBalloonTip(10)
        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

Enjoy!