Announcement
Collapse
No announcement yet.
Get the event Group name
Collapse
X
-
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:
-
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:
-
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:
-
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:
-
Leave a comment: