Home Projects AVR Programming Guides Electrical Fundamentals Insteon Saving Electricity

Recent Updates

EasyGrow Greenhouse
Follow our adventure of assembling an 8x12 EasyGrow Greenhouse.
AVR Programming Guides
We have some nice AVR code samples to share. Lots of AVR goodies like timers, interrupts, and pin I/O for the beginner.
Watts Tables
Use these tables to help you determine how much various items in your house cost you by the day, month, and year.
Saving Electricity
A list of a variety of ways to help you save money by learning how much it costs to run things.
What is a Kilowatt Hour
Saving money on your electric bill starts with understanding what a kilowatt hour is.
How To Measure Watts
Learn a variety of ways to measure watts in your house.
Read Your Power Meter
By reading your power meter you can get a good idea of how much various electrical devices cost you.
Electronics Fundamentals
Learn some basic electronics fundamentals and see if you enjoy the field of electronics.














Display all Insteon Events with Visual Basic 6

There are a lot of events that you can receive in Visual Basic. To learn what they are, we have made this simple snippet of code.

What it does is create an event sub for each of the SmartHome Device Managers events. Then you can simply run this code and watch events fly by. After a while, you'll get an idea of which events are available and can start writing your own code.

Start with a blank Form. Add a listbox to it called ListBox1. In the form, paste the following code (warning: you will have to remove the line breaks if you copy and paste from this HTML page, instead, get it from here)

 

Option Explicit
Dim WithEvents sm As SDM3Server.SDM3

Private Sub Form_Load()
Set sm = New SDM3Server.SDM3
End Sub

Private Sub sm_OnButtonTapEvent(ByVal buttonID As Integer)
lstInsteon.AddItem buttonID
End Sub

Private Sub sm_OnConnectedAndReady()
lstInsteon.AddItem "CNR"
End Sub

Private Sub sm_OnEvent(ByVal eventID As Integer)
lstInsteon.AddItem eventID
End Sub

Private Sub sm_OnINSTEON(ByVal eventID As Integer, ByVal fromID As String, ByVal toID As String, ByVal flags As Integer, ByVal cmd1 As Integer, ByVal cmd2 As Integer, ByVal extendedData As String)
lstInsteon.AddItem "eventID: " & eventID & " - fromID: " & fromID & " - toID: " & toID & " - flags: " & flags & " - cmd1: " & cmd1 & " - cmd2: " & cmd2 & " - extendedData: " & extendedData, 0
End Sub

Private Sub sm_OnINSTEONPacket(ByVal fromID As String, ByVal toID As String, ByVal flags As Integer, ByVal cmd1 As Integer, ByVal cmd2 As Integer, ByVal extendedData As String)
lstInsteon.AddItem "PACKET - eventID: " & eventID & " - fromID: " & fromID & " - toID: " & toID & " - flags: " & flags & " - cmd1: " & cmd1 & " - cmd2: " & cmd2 & " - extendedData: " & extendedData, 0
End Sub

Private Sub sm_OnMyINSTEONMessage(ByVal fromID As String, ByVal flags As Integer, ByVal cmd1 As Integer, ByVal cmd2 As Integer, ByVal extendedData As String)
lstInsteon.AddItem "MY - fromID: " & fromID & " - toID: " & toID & " - flags: " & flags & " - cmd1: " & cmd1 & " - cmd2: " & cmd2 & " - extendedData: " & extendedData, 0
End Sub

Private Sub sm_OnNAKINSTEON()
lstInsteon.AddItem "NAK"
End Sub

Private Sub sm_OnOtherINSTEONMessage(ByVal fromID As String, ByVal toID As String, ByVal flags As Integer, ByVal cmd1 As Integer, ByVal cmd2 As Integer, ByVal extendedData As String)
lstInsteon.AddItem "OTHER - fromID: " & fromID & " - toID: " & toID & " - flags: " & flags & " - cmd1: " & cmd1 & " - cmd2: " & cmd2 & " - extendedData: " & extendedData, 0
End Sub

Private Sub sm_OnSALADText(ByVal Text As String)
lstInsteon.AddItem "SALADText: " & Text
End Sub

Private Sub sm_OnText(ByVal Text As String)
lstInsteon.AddItem "sm_onText: " & Text
End Sub

Private Sub sm_OnTickEvent()
lstInsteon.AddItem "Tick..."
End Sub

Private Sub sm_OnUSBArrival(ByVal vendorID As Long, ByVal productID As Long)
lstInsteon.AddItem venderID & ":" & productID
End Sub

Private Sub sm_OnX10Address(ByVal x10text As String)
lstInsteon.AddItem "X10 Address: " & x10text, 0
End Sub

Private Sub sm_OnX10Command(ByVal x10text As String)
lstInsteon.AddItem "X10 Command: " & x10text, 0
End Sub

Private Sub sm_OnX10Extended(ByVal x10data As String)
lstInsteon.AddItem "X10 Extended: " & x10data, 0
End Sub


 

 

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.
 
Saturday, 29-Apr-2017 02:22:39 PDT