How to unregister my own device events?

Hi Team,

I am able to publish the events from spark core and able to register the event listener using c# libraries and there is no issues. I am doing it for water sensor. Now I want my “Monitor” or c# event listener to stop listening to events from spark.

Is there any way to do that??

I am using the code below to listen to spark events:

core.EventReceived += Event_Received;

Please let me know.

@satendra4u - Unregister as follows:

core.EventReceived -= Event_Received;

Which C# library are you using?

I am using yours : SparkIODotNet. I tried this but still it sends me the events.

Now, I put a check ( timer ) in the core to send only one event in 10 seconds.

Please let me know if there is another way to do that.

Thanks,
Satyen

@satendra4u You have found a bug. I am working on it now.

Chris

1 Like

@satendra4u I checked an update in on GitHub. Please update your source code and let me know how it goes. I am pleased to see you using my library and would value any feedback you have.

I found the same issue with sending too many events sometimes. My issue was around debouncing a physical switch. Pressing a switch sometimes generated 2-5 events in a second. I had to take care of this in local code to prevent the flood of events.

Good Luck and keep me posted!

1 Like

Thanks Chris. Let me check tonight and I will send the update.