Reply To: Homeseer and EZIO8SA 2017-12-21T12:26:59+00:00

HOME Forums Input/Output EZIOxx Homeseer and EZIO8SA Reply To: Homeseer and EZIO8SA

Anonymous
Post count: 35

Feel free to model yours after mine. I’m using an EZIO2x4 to monitor two exterior gates, monitor two garage doors, and operate two garage door openers.


' This script assumes you are using the EZIO2x4 as follows:
'
' 1. The EZIO2x4 is configured with the default settings, except that
' relays 1 and 2 each have timers set to 2, the timers are enabled,
' and the timers are set to mean seconds. Configure these settings
' using SimpleHomeNet's utility.
'
' 2. Relays 1 and 2 are wired in parallel with garge door opener
' switches, so that actuating a relay is the same as pushing the
' opener button (and the auto-off timer from assumption 1 therefore
' provides releasing the opener button).
'
' 3. Inputs 1 and 2 are being used with dry contacts to monitor the
' status of garage doors operated by relays 1 and 2.
'
' TO USE THIS SCRIPT:
'
' 1. Plug in your own EZIO2x4's Insteon address in g_szEZIO_Address
' below.
'
' 2. Place this script in your HomeSeer's scripts folder.
'
' 3. Add the this line:
'
' hs.RunEx("EZIO2x4-Garage.vb","RegisterDevices",parm)
'
' to your existing Insteon_ExtDevSupport.vb script's RegisterDevices
' routine (right after the Try is a good place).
'
' 4. You may use the HomeSeer devices this script creates in any of your
' HomeSeer scripts or events.
'
' 5. Your scripts/events may call EZIOPollDevices at any time to force a
' poll of inputs 1-4 and update status (not necessary if Insteon
' broadcasts are reliable in your home, but nice to have for times
' when things get out of sync).
'
' 6. Your scripts/events may call EZIOOperateRelay to switch on one of
' the relays (pass 1 or 2 as the parm to specify which relay).

Const Private g_szScriptName As String = "EZIO2x4-Garage.vb"
Const Private g_szEZIO_Address As String = "01.02.03" ' The Insteon address of the EZIO controller
Const Private g_szEZIO_DevName As String = "EZIO1" ' A unique name for the EZIO device.
Const Private g_szEZIO_DevLocation As String = "Garage" ' The location for the EZIO HomeSeer device info
Const Private g_szEZIO_HouseCode As String = "X" ' We are going to use this House Code
Const Private g_dwEZIO_FirstDeviceCode As Integer = 1 ' The Device Code (DC) that will hold the first EZIO device
Const Private g_bEZIO_Enabled As Boolean = True ' Set to True to enable EZIO2x4 support, False to disable
Dim Private g_bEZIO_Busy As Boolean = False ' We need to know if EZIO device change messages are caused by our own functions
Dim Private g_bDebug As Boolean = 0 ' Enable for lots of nice logging in HomeSeer's log

'
'
Call this method from the RegisterDevices() of Insteon_ExtDevSupport.vb
'

Public Sub RegisterDevices(ByVal parm As Object)
Try
g_bEZIO_Busy = False

If g_bEZIO_Enabled Then
hs.plugin("Insteon").ExtDev_RegisterExternalDeviceSupport(g_szEZIO_DevName,g_szEZIO_Address,g_szScriptName,"EZIOReceiveData")
EZIOCreateDevices()
hs.plugin("Insteon").ExtDev_TransmitToExternalDevice(g_szEZIO_DevName,&H7,&H46,0) ' turn off relay one
hs.plugin("Insteon").ExtDev_TransmitToExternalDevice(g_szEZIO_DevName,&H7,&H46,1) ' turn off relay two
EZIOPollDevices(vbNull) ' refresh with actual values reported by device
EZIOProcessStatus(&hF0) ' we just set the relays off, so assume openers NOT operating
End If

hs.RegisterStatusChangeCB(g_szScriptName,"EZIOStatusChangeCallback")

Catch ex As Exception
hs.WriteLog(g_szScriptName, "Error in RegisterDevices " & ex.ToString)
End Try
End Sub

'
'
The Insteon plug-in calls this routine every time a device changes
'

Public Sub EZIOStatusChangeCallback(ByVal parms)
Dim hc As String
Dim dc As Integer
Dim Status As Integer

Try
If g_bEZIO_Enabled Then

hc = parms(0)
dc = parms(1)
Status = parms(2)

If (hc = g_szEZIO_HouseCode) AND (dc >= g_dwEZIO_FirstDeviceCode) AND (dc = 1 AND iDevice <= 2 Then
hs.plugin("Insteon").ExtDev_TransmitToExternalDevice(g_szEZIO_DevName,&H7,&H45,iDevice - 1)
if g_bDebug Then hs.WriteLog(g_szScriptname,"EZIOOperateRelay: Sending 0x45 for unit " & iDevice)
Else
hs.WriteLog(g_szScriptname,"EZIOOperateRelay: Was expecting 1 or 2 as parameter")
End If
End If

Catch ex As Exception
hs.WriteLog(g_szScriptName,"Error in EZIOOperateRelay: " & ex.ToString)
End Try

End Sub

The board won’t let me post the whole thing. Continued in next post.