New Home

Recent Updates

New Home
Please visit us at our new home. All content has been moved there.














































































Turn Insteon Devices On and Off with Visual Basic 6

Make sure you have already followed the instructions to Add Insteon Support to Visual Basic.

You should already have the following code:

Option Explicit
Dim WithEvents sm As SDM3

Private Sub Form_Load()
    ' create a new instance of the SDM
    Set sm = New SDM3Server.SDM3
End Sub

' this sub will be called when the
' PLC receives an Insteon Event

Private Sub sm_OnText(ByVal Text As String)
    Debug.Print Text
End Sub

Now we are going to add a command button, and put the command to turn a light on to 100% brightness:

Private Sub Command1_Click()
    ' tell the device to turn on
    sm.SetOnLevelText "07.B1.12", "100%"
End Sub

The function SetOnLevelText is used to turn a device on and off. Simply pass the device ID as the first parameter, and the desired level as the second parameter, followed by the % sign.

You are now ready to create a project that will control the Insteon in your house using Visual Basic.

 

Jason Bauer

Written by

Jason Bauer is an owner and programmer for Portforward.com. He's allergic to twitter and facebook, but you can find more of his articles in the Guides section.
 
Friday, 19-Apr-2024 01:38:04 PDT