Homeseer and EZIO8SA 2008-04-23T12:27:48+00:00

HOME Forums Input/Output EZIOxx Homeseer and EZIO8SA

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • Anonymous
    Post count: 3
    #39930 |

    I am running Homeseer and am trying to install the 8SA to send some insteon commands to control lighting scene groups based on relay closure inputs. I can’t seem to get homeseer to recognize that the 8SA exists either in tap link mode or by manually adding the PLM insteon address as a device. The SHN utility finds it all just fine, so I know the unit is functional. Am I going to have to manually link the 8SA to a “hard” insteon device (extra keypadlink button or something) which then controls my scene?

    Was kind of hoping more for Homeseer to see the insteon command from the EZIO and respond directly…….

    Anonymous
    Post count: 1001

    Can’t help from Homeseer perspective, but the EZIOxx family of devices require an Input to be LINKed to something before an Insteon command is issued when the Input changes state. It is the “Controller of” Link record in the EZIOxx link database that tells the EXIOxx where to direct the Insteon Group Cleanup ON/OFF message when the Input changes state. Some HA software periodically queries devices to determine the current state, don’t know if Homeseer has that capability or how useful that would be. Depends on how quickly you need to know when the Input changes state.

    The need to be LINKed is not unique to EZIOxx devices. The Smarthome Keypadlinc, for example, with its 6 or 8 buttons, pressing button 3 does not cause an Insteon command to be issued unless button 3 is LINKed to something. As with the EZIOxx, it is the “Controller of” link database entry in the Keypadlinc that tells the Keypadlinc where to send the Group Cleanup ON/OFF commands.

    EDIT: There is a feature of the EZIOxx devices that permits a broadcast message when the input is not linked. From the EZIOxx Command Set document…

    Broadcast on Status Change: when the input is not linked, a broadcast message is sent with the input status encoded.

    EDIT2: Tested with an EZIO2X4 (inputs are like an EZIO8SA, just not as many). Turning on the “Broadcast on Status Change” option, when an Input state change occurred, a Broadcast message is sent, Status Change command 0x27 in cmd1, bit pattern in cmd2 reflects the current state of each of the Inputs.

    Don’t know if Homeseer supports this option.

    Anonymous
    Post count: 3

    Homeseer does set up crosslink communications with any of the Insteon devices it recognizes, so in that regard, if I link the EZIO input to a spare button on a keypadlink, the KPL will report immediately to Homeseer that it’s status has changed. From there, I can set events to handle the scenes.

    Thanks for your input and assistance!

    Anonymous
    Post count: 6

    You need to interface it with Insteon_ExtDevSupport_Support.vb found in the scripts directory. You will have to rename it to Insteon_ExtDevSupport.vb and modify the file for the EZIO8SA.

    Good luck. Mine works well controlling the outputs but has no clue as to the status of the inputs. There is also a file I found on the Homeseer board called EZIO2X4 that looks interesting. I get similar results using it with slightly different results. If you solve the input status problem, Please let me know.

    Bruce

    Anonymous
    Post count: 35

    The EZIO modules can send broadcasts on input changes, which HomeSeer can listen for. If you link the EZIO to the HomeSeer’s PLM or PLC, the EZIO will also send group broadcasts and followups, just like any other Insteon device.

    I have several EZIO2x4’s reporting status changes to HomeSeer without any problems.

    The scripts are, alas, somewhat custom jobs. A script for supporting a fireplace has different requirements from one supporting a garage door or a doorbell. The basics of handling the communication are the same, but what you do with the information depends on what you want to have happen. This is why you’ll find plenty of sample scripts, but nothing “out of the box” ready to go for your particular application. However, if you have any programming experience at all, you won’t find it hard to whip up your own script tailored to your own requirements.

    Anonymous
    Post count: 3

    Thanks Jeff! I’ve been beating my head against the wall for hours on this. Any links to sample scripts you could share? I am entirely new to script writing but can figure it out if I have a sample. Basically, I am using a “driveway alert” device to trigger one of the EZIO inputs which I want to use to turn a HomeSeer scene on.

    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.

    Anonymous
    Post count: 35

    Here’s more of the script:


    '
    '
    Poll EZIO (may be called from external scripts or from within HomeSeer)
    '

    Public Sub EZIOPollDevices(parms as object)
    Try
    If g_bEZIO_Enabled Then
    hs.plugin("Insteon").ExtDev_TransmitToExternalDevice(g_szEZIO_DevName,&H7,&H49,0)
    if g_bDebug Then hs.WriteLog(g_szScriptname,"EZIOPollDevices: Sending 0x49 to request report")
    End If

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

    '
    '
    The Insteon plug-in calls this routine every time there's data from our device
    '

    Public Sub EZIOReceiveData(ByVal InsteonData As String)
    Dim Data() As String
    Dim Flags As Long
    Dim Status As Long
    Dim MsgType As Long

    Try
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Received Insteon Data: " & InsteonData & "")
    Data = Split(InsteonData, " ")

    If Data(0) = "ACK" Then ' This was an ACK response to a prior command. There is extra data here. The standard ACK will also be sent

    Select Case Val("&h" & Data(1))
    Case &H49 ' Ack was to a Sensor Report command
    if g_bDebug Then EZIOSensorReport(Val("&h" & Data(2)), Val("&h" & Data(12)))
    End Select

    Else ' This is a standard Insteon message

    Flags = CLng("&H" & Data(7))
    If g_bDebug Then hs.WriteLog(g_szScriptName,"FlagsRaw=" & Hex$(Flags) & ", masked=" & Hex$(Flags AND &hE0))

    Select Case (Flags AND &hE0)

    Case &h80 ' Broadcast transmissions from our device
    MsgType = CLng("&h" & Data(8)) ' 0x27 means input sensor status change
    Status = CLng("&h" & Data(9)) ' bit-mapped, 0=all off, 1=1 on, 2=2 on, 3=1 and 2 on, etc.
    If MsgType = &H27 Then
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Got broadcast from our device: MsgType=" & Hex$(MsgType) & ", Status=" & Hex$(Status) & "")
    EZIOProcessStatus(Status) ' Input sensor change status report
    End If

    Case &h20 ' Ack replies from our device to any other device
    MsgType = CLng("&h" & Data(8))
    Status = CLng("&h" & Data(9)) ' bit-mapped, 0=all off, 1=1 on, 2=2 on, 3=1 and 2 on, etc.
    If MsgType = &H49 Or MsgType = &h45 OR MsgType = &h46 Then
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Got ACK from command to our device: MsgType=" & Hex$(MsgType) & ", BitMap=" & Hex$(Status) & "")
    EZIOProcessStatus(Status) ' Input sensor change status report
    End If

    Case &hC0 ' Group control broadcast commands from our device
    MsgType = CLng("&h" & Data(6))
    Status = CLng("&h" & Data(8))
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Got group broadcast from our device: Group=" & Hex$(MsgType) & ", Cmd=" & Hex$(Status) & "")
    EZIOProcessBroadcast(MsgType,Status)

    Case &hA0 ' Nak replies from our device to any other device
    If g_bDebug Then hs.WriteLog(g_szScriptName,"NAK from our device to some other device")

    Case &h00 ' Direct commands from our device to any other device
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Direct from our device to some other device")

    Case &h40 ' Group control clean-up commands from our device
    MsgType = CLng("&h" & Data(6))
    Status = CLng("&h" & Data(8))
    If g_bDebug Then hs.WriteLog(g_szScriptName,"Got group cleanup from our device: Group=" & Hex$(MsgType) & ", Cmd=" & Hex$(Status) & "")
    EZIOProcessBroadcast(MsgType,Status)

    Case &h60 ' Ack replies from our device to group clean-up commands from any device
    If g_bDebug Then hs.WriteLog(g_szScriptName,"ACK to group cleanup")

    Case &hE0 ' Nak replies from our device to group clean-up commands from any device
    If g_bDebug Then hs.WriteLog(g_szScriptName,"NAK to group cleanup")
    End Select

    End If

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

    '
    '
    Create input and output virtual devices (only if they don't already exist)
    '

    Private Sub EZIOCreateDevices()
    Dim Lp As Integer
    Dim Ref As Long
    Dim dv As Object
    Dim dc As String
    Dim DevName As String
    Dim Button As String
    Dim Label As String

    if g_bDebug Then hs.WriteLog(g_szScriptName,"EZIOCreateDevices(): Starting")

    Try
    g_bEZIO_Busy = True

    For Lp = 0 To 5
    dc = (g_dwEZIO_FirstDeviceCode + Lp).ToString
    If hs.DeviceExists(g_szEZIO_HouseCode & dc) = -1 Then
    Select Case Lp
    Case 0,1
    DevName = "Garage Opener " & (Lp + 1).ToString
    Button = g_szScriptName & "(""EZIOOperateRelay"",""" & Lp + 1 & """)"
    Label = "Operate"
    Case Else
    DevName = "Garage Door " & (Lp - 2 + 1).ToString
    Button = g_szScriptName & "(""EZIOPollDevices"",""0"")"
    Label = " Verify "
    End Select
    Ref = hs.NewDeviceRef (DevName)
    dv = hs.GetDeviceByRef(Ref)
    dv.hc = g_szEZIO_HouseCode
    dv.dc = dc
    dv.can_dim = False
    dv.location = g_szEZIO_DevLocation
    dv.location2 = "auto-created"
    dv.misc = &h10
    dv.dev_type_string = "Status Only"
    hs.SetDeviceValue (DevName,0)
    hs.SetDeviceString (DevName,"Unverified",False)
    hs.SetDeviceStatus (DevName,3)
    hs.SaveEventsDevices()
    hs.DeviceButtonAdd (g_szEZIO_HouseCode & dc,Button,Label)
    hs.WriteLog (g_szScriptName,"Created device " & DevName & " as " & g_szEZIO_HouseCode & dc)
    End If
    Next

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

    g_bEZIO_Busy = False
    if g_bDebug Then hs.WriteLog(g_szScriptName,"EZIOCreateDevices(): Finished")
    End Sub
    Anonymous
    Post count: 35

    More (this is quite annoying):



    '
    '
    helper function: returns numeric code meaning "on" or "off"
    '

    Private Function EZIOOnOffCode (ByVal Code as Byte) as Byte
    If Code Then
    EZIOOnOffCode = 2 ' on
    Else
    EZIOOnOffCode = 3 ' off
    End If
    End Function

    '
    '
    helper function: returns string representing device status
    '

    Private Function EZIODevStatus (ByVal Code as Byte,ByVal DC as Integer) as String
    Select Case DC ' NOTE: This is the DC, which is one more than the "real" device number!
    Case 1,2 ' relays
    Select Case Code
    Case 2: EZIODevStatus = "Moving"
    Case 3: EZIODevStatus = "Stopped"
    Case Else: EZIODevStatus = "Unknown"
    End Select

    Case Else ' garage door sensors and fence gate sensors
    Select Case Code
    Case 2: EZIODevStatus = "Closed"
    Case 3: EZIODevStatus = "Open"
    Case Else: EZIODevStatus = "Unknown"
    End Select
    End Select
    End Function

    Private Function EZIODevValue (ByVal Code as Byte) As Long
    If Code = 2 Then
    EZIODevValue = 1
    ElseIf Code = 3 Then
    EZIODevValue = 0
    Else
    EZIODevValue = 999
    End If
    End Function

    Private Function EZIODevString(ByVal Code as Byte,DC as Integer) As String
    Select Case DC ' NOTE: This is the DC, which is one more than the "real" device number!
    Case 1,2 ' relays
    Select Case Code
    Case 2: EZIODevString = "Moving"
    Case 3: EZIODevString = "Stopped"
    Case Else: EZIODevString = "Unknown"
    End Select
    Case 3,4 ' garage door sensors
    Select Case Code
    Case 2: EZIODevString = "Door Closed at " & Now
    Case 3: EZIODevString = "Door Open at " & Now
    Case Else: EZIODevString = "Unknown Status at " & Now
    End Select
    Case Else ' fence gate sensors
    Select Case Code
    Case 2: EZIODevString = "Gate Closed at " & Now
    Case 3: EZIODevString = "Gate Open at " & Now
    Case Else: EZIODevString = "Unknown Status at " & Now
    End Select
    End Select
    End Function

    '
    '
    helper routine: changes virtual devices (only if new value differs from old value)
    '

    Private Sub EZIOSetIfChanged(ByVal HC as String,ByVal DC as String,ByVal NewCode as Byte)
    Dim OldCode as Byte
    Dim OldStatus as String
    Dim NewStatus as String
    Dim NewValue as Long
    Dim NewString as String

    OldCode = hs.DeviceStatus(HC & DC)
    OldStatus = EZIODevStatus (OldCode,DC)

    If OldCode NewCode Then
    NewStatus = EZIODevStatus (NewCode,DC)
    NewValue = EZIODevValue (NewCode)
    NewString = EZIODevString (NewCode,DC)

    hs.WriteLog(g_szScriptName,"EZIO " & HC & DC & " changed from " & OldStatus & " to " & NewStatus & "")
    hs.SetDeviceStatus(HC & DC,NewCode)
    hs.SetDeviceString(HC & DC,NewString,False)
    hs.SetDeviceValue (HC & DC,NewValue)
    ElseIf g_bDebug Then
    hs.WriteLog(g_szScriptName,"EZIO " & HC & DC & " was already " & OldStatus & "; no change")
    End If
    End Sub

    '
    '
    helper routine: processes EZIO device change status messages
    '

    Private Sub EZIOProcessStatus(ByVal Status As Byte)
    If g_bDebug Then hs.WriteLog(g_szScriptName,"EZIOProcessStatus(): " & Hex$(Status))

    Try
    g_bEZIO_Busy = True

    If (Status > 127) Then
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 0).ToString,EZIOOnOffCode(Status AND 1))
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 1).ToString,EZIOOnOffCode(Status AND 2))
    Else
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 2).ToString,EZIOOnOffCode(Status AND 1))
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 3).ToString,EZIOOnOffCode(Status AND 2))
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 4).ToString,EZIOOnOffCode(Status AND 4))
    EZIOSetIfChanged(g_szEZIO_HouseCode,(g_dwEZIO_FirstDeviceCode + 5).ToString,EZIOOnOffCode(Status AND 8))
    End If

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

    g_bEZIO_Busy = False
    End Sub
    Anonymous
    Post count: 35

    And, finally, the last part:



    '
    '
    helper routine: logs so-called "sensor reports"
    '

    Private Sub EZIOSensorReport(ByVal Sensor As Byte, ByVal Value As Byte)
    Try
    hs.WriteLog(g_szScriptName,"EZIOSensorReport: Unit=" & Sensor.ToString & ", State=" & Value.ToString)

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

    '
    '
    helper routine: processes EZIO device broadcasts
    '

    Private Sub EZIOProcessBroadcast(ByVal GroupNum As Byte, ByVal CmdNum As Byte)
    Dim dc As String

    Try
    If g_bDebug Then hs.WriteLog(g_szScriptName,"EZIOProcessBroadcast(): " & Hex$(GroupNum) & ", " & Hex$(CmdNum))
    If GroupNum >= 1 AND GroupNum <= 4 Then ' makes SILLY assumption that sensor 1 is sending group 1, 2 sends 2, and so forth!
    dc = ( (g_dwEZIO_FirstDeviceCode + 2 + GroupNum) - 1).ToString
    Select Case CmdNum
    Case &H11:
    EZIOSetIfChanged(g_szEZIO_HouseCode,dc,2)
    Case &H13:
    EZIOSetIfChanged(g_szEZIO_HouseCode,dc,3)
    End Select
    End If

    Catch ex As Exception
    hs.WriteLog(g_szScriptName,"Error in EZIOProcessBroadcast: " & ex.ToString)
    End Try
    End Sub
    Anonymous
    Post count: 408

    Jeff – thanks for the scripts!!

    In the future, if it saves you time, feel free to email them to me, and we can post them with a link for you.

    Anonymous
    Post count: 15

    Could anyone post their script, I had to reformat my HD and I lost my functional setup so I have to rebuild from scratch… and I can’t seem to find the script I used before.

    Thanks for your help

    Anonymous
    Post count: 15

    Could you please post your scripts for the EZIO8SA, this would help me get back on track and probably help others too

    Thanks

    Dan

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.