Announcement
Collapse
No announcement yet.
HSEvent
Collapse
X
-
I have HS3 code that makes a single call to RegisterEventCB requesting multiple events by ORing the bits together. This does not appear to work with HS4, you must make multiple calls to register for multiple events. That's my experience.
-
It is the same in HS4. The routine I use to register for user-variable event callbacks is
Code:Public Sub RegisterEvents(ByVal iEventType As Integer) '1 value '2 string HomeSeer.PluginSdk.Devices.EMiscFlag.ShowValues, '3 log 'If gDebugLog Then 'hsWritelog(PLUGIN_DEBUG, "Register Events " & iEventType.ToString & ", bValueCallbackRegistered=" & bValueCallbackRegistered.ToString & ", bStringCallbackRegistered=" & bStringCallbackRegistered.ToString) 'End If If iEventType = 1 AndAlso Not bValueCallbackRegistered Then hsWritelog(PLUGIN_DEBUG, "RegisterEvents " & iEventType.ToString) bValueCallbackRegistered = True hs.RegisterEventCB(HomeSeer.PluginSdk.Constants.HSEvent.VALU E_CHANGE, PLUGIN_NAME) hs.RegisterEventCB(HomeSeer.PluginSdk.Constants.HSEvent.VALU E_SET, PLUGIN_NAME) ElseIf iEventType = 2 AndAlso Not bStringCallbackRegistered Then hsWritelog(PLUGIN_DEBUG, "RegisterEvents " & iEventType.ToString) bStringCallbackRegistered = True hs.RegisterEventCB(HomeSeer.PluginSdk.Constants.HSEvent.STRI NG_CHANGE, PLUGIN_NAME) ElseIf iEventType = 3 AndAlso Not bLogCallbackRegistered Then hsWritelog(PLUGIN_DEBUG, "RegisterEvents " & iEventType.ToString) bLogCallbackRegistered = True hs.RegisterEventCB(HomeSeer.PluginSdk.Constants.HSEvent.LOG, PLUGIN_NAME) End If End Sub
Leave a comment:
-
Can anyone confirm how to register for multiple event types? In hs3, you ORd the values and made one call. I'm hs4, I've had to register each type via separate calls.
Anyone confirm this?
Leave a comment:
-
Originally posted by dcorsus View PostDigging this up again .....
Does anyone know where is the definition of the "PARAMS" object that accompanies the HSEvent callback? I've registered for CONFIG_CHANGE events because I want to get notified when a user deletes one of the PIs devices.
At least 2 questions:- what triggers CONFIG-CHANGE, is this only deletes, but also creates or modifies? Suspect the params object provides more detail
- what exaclty is to be found in params? Where is it documented? I looked at the HS4 documents and couldn't find anything. I looked at HS3 documents and at least I could find it but it shows 5 fields of PARAMS, but I see 6 (5 integers and a string). What are they?
- Likes 1
Leave a comment:
-
Digging this up again .....
Does anyone know where is the definition of the "PARAMS" object that accompanies the HSEvent callback? I've registered for CONFIG_CHANGE events because I want to get notified when a user deletes one of the PIs devices.
At least 2 questions:- what triggers CONFIG-CHANGE, is this only deletes, but also creates or modifies? Suspect the params object provides more detail
- what exaclty is to be found in params? Where is it documented? I looked at the HS4 documents and couldn't find anything. I looked at HS3 documents and at least I could find it but it shows 5 fields of PARAMS, but I see 6 (5 integers and a string). What are they?
Leave a comment:
-
In your plugin, HSEvent would be defined as (C#):
Code:public override void HsEvent(HomeSeer.PluginSdk.Constants.HSEvent eventType, object[] @params) { Console.WriteLine("HSEvent: " + eventType.ToString()); }
Code:public enum HSEvent { LOG = 2, AUDIO = 8, CONFIG_CHANGE = 32, STRING_CHANGE = 64, SPEAKER_CONNECT = 128, CALLER_ID = 256, VALUE_CHANGE = 1024, VALUE_SET = 2048, VOICE_REC = 4096, SETUP_CHANGE = 8192, RUN_SCRIPT_SPECIAL = 16384, GENERIC = 32768 }
Leave a comment:
-
HSEvent
The SDK docs identifies a parameter of HSEvent type for the HSEvent method. I was not able to find the a HSEvent type definition. Where is it? Are there any examples of using HSEvent method? I did not see it in the samples provided.Tags: None
Leave a comment: