Closed EdDuran closed 2 years ago
@EdDuran, are you the author of the ScreenLogic plugin? I don't understand when RegisterEventCB() is called? This method is supposed to be called only once when the plugin is initialized, is this what you do? It looks like the problem is coming from the ScreenLogic plugin that tries to get some features when it receives an update in HSEvent of type HSEvent.CONFIG_CHANGE with a target being EConfigChangeTarget.Event. It probably not meant to do that and it probably tries to get features with ids that are actually event or event group ids. In other words it is probably a bug in the ScreenLogic plugin in the implementation of the HSEvent callback. Do you get the errors if the ScreenLogic plugin is shut down?
Yes - I'm the author. RegisterEventCB is called once during initialization and yes, the errors did go away when the plugin is shutdown.
CONFIG_CHANGE parameters: // p0 The event type as an System.Int32 with a value of ConfigChange // p1 The target of the config change event as defined by EConfigChangeTarget and represented as an System.Int32 // p2 UNUSED - always 0 // p3 Target unique reference number as an System.Int32 // p4 The type of change happening as defined by EConfigChangeAction and represented by an System.Int32 // p5 A description of what changed as a System.String
Ok - I understand the EConfigChangeTarget.Event - p1 above - I should be testing that. I found that in the "documentation" but not finding in VisualStudio
When I made the call to HsFeature hsFeature = _hs.GetFeatureByRef(refId) to look up the object, I am returned a Null, HomeSeer is logging the error. I would have either expect an Exception with the details, or the null which I can then decided to log the error myself.
This seems clearly my bug for not deciphering the CONFIG_CHANGE parameters appropriately
Thank you /keith
HomeSeer 4.2.14.0, WIndows 10 / Linux Ubuntu / Raspberry Pi
Problem
The call to RegisterEventCB appears to cause a Dual-Action Event with a Delay to log "Object reference not set to an instance of an object" errors
Description
While testing the ScreenLogic plugin, odd "Object reference not set to an instance of an object" errors appeared in the Log. The errors occur when a Dual-Action Event with Delay was run. The Event uses a virtual device. The reference Ids were either very low or very high, but none associated with the Plugin. Screenshot attached, with "DeviceManager" lines to show what events were received, and not referencing Features associated with my plugin.
Found the errors are logged only after RegisterEventCB is called. RegisterEventCB is used to inform the Plugin when Features are renamed and it seems to work fine.
Remove the Delay portion of the Event and no errors are logged
Screenshots
Log and Event tested
Expected Behavior
Don't expect HomeSeer to log errors for the Event an event with a Delay in it