Announcement

Collapse
No announcement yet.

Get the event Group name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • alphatech
    replied
    I can not thank you enough Jon. It is perfect, thank you.

    Leave a comment:


  • jon00
    replied
    Actually, it may be more reliable with this code:

    Code:
        Sub Main(ByVal Parms As Object)
    
            Dim EventGroup As String = ""
            Dim EventName As String = ""
            Dim LastEvent As String = hs.GetLastEvent
            Try
                For Each evGroup As HomeSeerAPI.strEventGroupData In hs.Event_Group_Info_All
                    EventGroup = evGroup.GroupName.ToString
                    For Each eva As HomeSeerAPI.strEventData In hs.Event_Info_Group(evGroup.GroupID)
                        EventName = eva.Event_Name.ToString
                        If EventName = LastEvent Then Exit Try
                    Next
                Next
            Catch
            End Try
            hs.writelog("EventGroup", EventGroup)
            hs.writelog("EventName", EventName)
    
        End Sub

    Leave a comment:


  • jon00
    replied
    You can try the following; however it may not be 100% reliable if another event fires at the same time:

    Code:
        Sub Main(ByVal Parms As Object)
    
            Dim EventGroup As String = ""
            Dim EventName As String = ""
            Try
                For Each evGroup As HomeSeerAPI.strEventGroupData In hs.Event_Group_Info_All
                    EventGroup = evGroup.GroupName.ToString
                    For Each eva As HomeSeerAPI.strEventData In hs.Event_Info_Group(evGroup.GroupID)
                        EventName = eva.Event_Name.ToString
                        If EventName = hs.GetLastEvent Then Exit Try
                    Next
                Next
            Catch
            End Try
            hs.writelog("EventGroup", EventGroup)
            hs.writelog("EventName", EventName)
    
        End Sub

    Leave a comment:


  • alphatech
    replied
    Hi Jon,
    thanks for taking your time to write this.
    Sorry my mistake, I did not explain correctly, from that event that I call the script, I would like to know the event that calls it (hs.getlastevent) and the event group that is in. I do not know how to get this value.

    Leave a comment:


  • jon00
    replied
    Sure...this will provide a list in the log:

    Code:
        Sub Main(ByVal Parms As Object)
    
           Dim EventGroup As String = ""
           For Each evGroup As HomeSeerAPI.strEventGroupData In hs.Event_Group_Info_All
               EventGroup = evGroup.GroupName.ToString
               hs.writelog("EventGroup",EventGroup)
           Next
    
        End Sub

    Leave a comment:


  • alphatech
    started a topic Get the event Group name

    Get the event Group name

    Is it possible to get the group name (hopefully I'm using the right name for it) from within a script?

    Thanks
    Attached Files
Working...
X