Yet Another Free Extension for Blue Iris Adding AI Object Dectection/Reduction in False Alarms/Enhanced Notification of Activity/On Guard

I have an error I can't seem to get by. My computer crashed a few times, and when I try to start the program now I get "System.InvalidOperationException: 'Cannot load Counter Name data because an invalid index '' was read from the registry.'"

I've uninstalled, reinstalled without databases, check registry, nothing is standing out.


Code:
  Problem Event Name:    CLR20r3
  Problem Signature 01:    On Guard.exe
  Problem Signature 02:    0.1.0.0
  Problem Signature 03:    e2da15d1
  Problem Signature 04:    System
  Problem Signature 05:    4.8.4001.0
  Problem Signature 06:    5d37b3ae
  Problem Signature 07:    2f49
  Problem Signature 08:    161
  Problem Signature 09:    System.InvalidOperationException
  OS Version:    6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1:    0a9e
  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:    0a9e
  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789
 
Last edited:
I have an error I can't seem to get by. My computer crashed a few times, and when I try to start the program now I get "System.InvalidOperationException: 'Cannot load Counter Name data because an invalid index '' was read from the registry.'"

I've uninstalled, reinstalled without databases, check registry, nothing is standing out.


Code:
  Problem Event Name:    CLR20r3
  Problem Signature 01:    On Guard.exe
  Problem Signature 02:    0.1.0.0
  Problem Signature 03:    e2da15d1
  Problem Signature 04:    System
  Problem Signature 05:    4.8.4001.0
  Problem Signature 06:    5d37b3ae
  Problem Signature 07:    2f49
  Problem Signature 08:    161
  Problem Signature 09:    System.InvalidOperationException
  OS Version:    6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1:    0a9e
  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:    0a9e
  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789
That's a new one on me. Please look in: c:\users\YourUserName\AppData\Roaming (substituting your name). That may be a "hidden" directory for you. In that directory you should see a file call "OnGuard.txt". That is the log file for the application. Please let me know if you see anything related to InvalidOperationException. Please post or send me all of the information around there. That should let me track down at least the general area that is causing the problem. If I can find it I can fix it.

Things will definitely not work without the database.
 
I do have basic MQTT working locally. The vast majority of that work was choosing what library to use for the MQTT interface and getting a general feel for how things work.

It would be very helpful to know how people are using MQTT so I can make sure that I meet your needs. Just out of general curiosity I'd be interested to know what kind of devices you are working with.

Do you have a need for an MQTT cool-down period? Right now I think that this may be useful, but maybe with the way MQTT works that isn't too important.

I am working on some additional enhancements I'd like to add along with MQTT. This includes ruling out static/non moving objects (mostly vehicles).

With any luck I'll try to put out a new release next week.
I have posted a new version with MQTT on GitHub. However, it is not a new "Release". You'll need to download the zip (or whatever) and install the setup.exe. Let me know if you have any problems. I would like at least one or two people to test it. I also updated the .docx readme file.

Using MQTT is just a matter of setting (at a minimum) the server address and port. Then, go to any areas you'd like to trigger the MQTT. Click on the Set Notifications for the area. Click the Notify Using MQTT button. That button will turn green. MQTT is now on for that area. I did not implement MQTT cool down.

If this does not work the way you'd like it (or at all) then let me know.
 
  • Like
Reactions: silencery
That's a new one on me. Please look in: c:\users\YourUserName\AppData\Roaming (substituting your name). That may be a "hidden" directory for you. In that directory you should see a file call "OnGuard.txt". That is the log file for the application. Please let me know if you see anything related to InvalidOperationException. Please post or send me all of the information around there. That should let me track down at least the general area that is causing the problem. If I can find it I can fix it.

Things will definitely not work without the database.
Just to be clear. IF you can get the main window up you can also go to the Help menu and Log File. That will save you hunting around for the log file under AppData. However, it sounded like you couldn't get there from here.
 
Just as a heads up. For those of you who don't know DeepStack has now gone open source. They also put out a couple of new releases. However, they don't expect a new Windows release for about a week. That version will include NVidia GPU processing.

Last night I installed DeepStack on Windows using WSL/Ubuntu and a Docker container. I noticed about a 4X speedup in the processing of pictures. I have a new mid range NVidia card I wanted to try out. However, that setup was a major pain to setup. So, if you are running Windows I'd wait for the DeepStack release. If anyone else is interested in doing the Windows WSL setup I may be able to help you fumble your way through that setup.

Hopefully the DeepStack folk will make their guesstimate of about a week. We'll also have to see how easy their setup process will be.
 
  • Like
Reactions: silencery
MQTT: I would add a checkbox option for TLS. I commented out that part in the code, and MQTT worked to Home Assistant's Mosquitto broker (which uses a name and password, but not needed for tls). That's how BI does it. Actually the TLS checkbox is grayed out in BI. lol.
 
MQTT: I would add a checkbox option for TLS. I commented out that part in the code, and MQTT worked to Home Assistant's Mosquitto broker (which uses a name and password, but not needed for tls). That's how BI does it. Actually the TLS checkbox is grayed out in BI. lol.
You are correct. I sort of got lazy and assume that if you had a user name and password you wanted a secure connection. There isn't a reason you couldn't have a user name and password on an insecure connection. Personally, I that sending any user name and password over an unsecured connection is a very bad idea since people tend to re-use user names and passwords. Sending them in the clear is asking for problems, but that isn't always the case.
 
This is great, thanks for adding MQTT!

Unfortunately, installing the update broke my install. It looks like the cameras aren't found anymore which is crashing the app.

Here's what happened.
  1. Closed onguard. Ran a dirty update over the original install by running new setup.exe
  2. Saw MQTT settings were not available in the tools menu, so I assumed the update didn't work.
  3. Closed onguard, uninstalled, re-ran setup.exe
  4. Now on startup, the following error occurs on startup, and when clicking on cameras or AOI. It appears the app thinks the cameras and AOI still exist but can't find them. At least MQTT settings are there now!
  5. I'll keep messing with it to see if I can get it working
Code:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at SAAI.AreasOfInterestCollection.Load() in C:\Users\Ken\Source\Repos\OnGuard\AreasOfInterestCollection.cs:line 101
   at SAAI.CameraData.Init() in C:\Users\Ken\Source\Repos\OnGuard\CameraData.cs:line 92
   at SAAI.AllCameras.Load() in C:\Users\Ken\Source\Repos\OnGuard\AllCameras.cs:line 122
   at SAAI.MainWindow.Form1_Load(Object sender, EventArgs e) in C:\Users\Ken\Source\Repos\OnGuard\MainWindow.cs:line 130
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
On Guard
    Assembly Version: 0.1.0.0
    Win32 Version: 0.1.0.0
    CodeBase: file:/C:/Program%20Files%20(x86)/On%20Guard/On%20Guard/On%20Guard.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 
Last edited:
This is great, thanks for adding MQTT!

Unfortunately, installing the update broke my install. It looks like the cameras aren't found anymore which is crashing the app.

Here's what happened.
  1. Closed onguard. Ran a dirty update over the original install by running new setup.exe
  2. Saw MQTT settings were not available in the tools menu, so I assumed the update didn't work.
  3. Closed onguard, uninstalled, re-ran setup.exe
  4. Now on startup, the following error occurs on startup, and when clicking on cameras or AOI. It appears the app thinks the cameras and AOI still exist but can't find them. At least MQTT settings are there now!
  5. I'll keep messing with it to see if I can get it working
Code:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at SAAI.AreasOfInterestCollection.Load() in C:\Users\Ken\Source\Repos\OnGuard\AreasOfInterestCollection.cs:line 101
   at SAAI.CameraData.Init() in C:\Users\Ken\Source\Repos\OnGuard\CameraData.cs:line 92
   at SAAI.AllCameras.Load() in C:\Users\Ken\Source\Repos\OnGuard\AllCameras.cs:line 122
   at SAAI.MainWindow.Form1_Load(Object sender, EventArgs e) in C:\Users\Ken\Source\Repos\OnGuard\MainWindow.cs:line 130
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
On Guard
    Assembly Version: 0.1.0.0
    Win32 Version: 0.1.0.0
    CodeBase: file:/C:/Program%20Files%20(x86)/On%20Guard/On%20Guard/On%20Guard.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:/C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
This is definitely related to the MQTT stuff. It didn't happen for me either on the development machine or the test machine. I was half expecting an error like this but didn't see one. The only thing I can say is that you'll need to start clean. I don't see a way of fixing this in the code. You can probably just delete the YourCameraName-AreasOfInterest.bin file. You'll need to recreate your areas.

Ordinarily I'd try to do a code fix, but I'm in the middle of adding new features and my code doesn't match the program you have.
 
No worries, I'll try to sort it out.

The camera info from the previous install is getting left behind somewhere. Just need to find it for a clean install. Right now I can't redo the setup because the app crashes when I get to the camera setup page (even after uninstalling and rebooting)
I've tried to make sure everything is clean by deleting the following locations:

%homepath%\AppData\Roaming\OnGuardDatabase\
%homepath%\AppData\Roaming\OnGuard.txt
%homepath%\AppData\Local\2K_Software\

My guess is there is some info stored in the registry somewhere?
 
Silencery, do you have visual studio installed? I had to run the code in debug mode to find out where it was crashing for me. Turned out the code it was erroring out on, was because of a corrupt registry error from my computer freezing / force shutdowns a few times.
 
no, i don't. I was just running the precompiled binary. I'll have to prepare a test environment to build in.
 
I have added a new release V1.2.1. This contains:

1. The formal MQTT support (with checkbox for secure connections).
2. It filters out parked vehicles from motion reporting. I was able to test that reasonably well. Note that these vehicles will still be outlined in the main window picture. There was a definite problem where a parked car would be reported as a car event type if some other motion triggered BlueIris to start taking pictures.
3. It attempts to combine real world vehicles that have multiple definitions (car, truck, ?) into one object. Often DeepStack thinks that a vehicle may be a car, may be a truck, etc.. On Guard then bumps the "confidence" level for that vehicle up a bit. I hesitate to do the confidence bumping, but I really think it is necessary because the AI confidences are artificially low. Unfortunately, the test pictures I had for this were accidentally deleted. So, the feature has not been tested well. If anyone has any test pictures where this has come up I'd appreciate getting a copy.

You very well may need to delete and re-create your area definition files (cameraPrefix-AreasOfInterest.bin). You may need to delete and rebuild your camera data as well (CameraData.bin).

As always, report bugs on GitHub or post them here.
 
Last edited:
You very well may need to delete and re-create your area definition files (cameraPrefix-AreasOfInterest.bin). You may need to delete and rebuild your camera data as well (CameraData.bin).

Ah! that fixed the startup issues for me. In my case (win10), the bin files were dumped into a crazy directory. The entire path and its contents were left behind in the uninstall.
C:\Users\username\AppData\Local\VirtualStore\Program Files (x86)\On Guard\On Guard

Once I finally found those bin files and deleted them, the crash was gone and the app is working again.

Thanks! Can't wait to test drive the mqtt connectivity
 
Ah! that fixed the startup issues for me. In my case (win10), the bin files were dumped into a crazy directory. The entire path and its contents were left behind in the uninstall.
C:\Users\username\AppData\Local\VirtualStore\Program Files (x86)\On Guard\On Guard

Once I finally found those bin files and deleted them, the crash was gone and the app is working again.

Thanks! Can't wait to test drive the mqtt connectivity
I guess I hadn't realized it was putting it in anyplace quite so strange. I've never run across VirtualStore before. I would think I would have, having worked at Microsoft on Windows. I'll put these files someplace a little more sane. Unfortunately, it will probably still be under AppData, just in an OnGuard directory directly under it. There is really no other good place to save files like this.
 
  • Like
Reactions: silencery
Just wanted to report back to say this new version (V1.2.1) with MQTT is working beautifully, thanks!
I now have it setup to send a jpg snapshot of the triggering image to our phones via pushover. It's also working in conjunction with the rest of my HA to trigger related functions (turn on lighting for that zone).
 
Just wanted to report back to say this new version (V1.2.1) with MQTT is working beautifully, thanks!
I now have it setup to send a jpg snapshot of the triggering image to our phones via pushover. It's also working in conjunction with the rest of my HA to trigger related functions (turn on lighting for that zone).
Great!

If you have any other suggestions I'll take a look. I am in the middle of working on other features, but depending on a feature suggested I could re-arrange my priorities. Right now I am planning on another release in the first/second week of January. I hope to (finally) implement movement direction (to/from/either/both area targets. It's a bit tricky, and it won't be perfect, but maybe it will be helpful.

It would be nice if DeepStack could identify packages being carried by a person. That way I could snag a few porch pirates. I theory the AI could be trained to do this, but it is a bigger task than I'd like to take on.

I'm also looking into changing the UI to .NET Core. That should make the UI usable on at least Linux, Android, maybe IOS.
 
I downloaded and installed On-Guard this weekend. It works great. Thanks for all your hard work.

I downloaded and tried to get 1.2.1 to install. The first time I installed it over the top of the old version. It appeared to install correctly but when I went into the program the new MQTT options were not listed. I downloaded again thinking I might have installed the same version and this time it asked me to repair or remove. I repaired started the program and no MQTT. I installed again and chose remove this time and then installed again. I started the program and it started normally with all of the old settings but still no MQTT options. Any recommendations on what to try next?
 
I downloaded and installed On-Guard this weekend. It works great. Thanks for all your hard work.

I downloaded and tried to get 1.2.1 to install. The first time I installed it over the top of the old version. It appeared to install correctly but when I went into the program the new MQTT options were not listed. I downloaded again thinking I might have installed the same version and this time it asked me to repair or remove. I repaired started the program and no MQTT. I installed again and chose remove this time and then installed again. I started the program and it started normally with all of the old settings but still no MQTT options. Any recommendations on what to try next?
Probably the best thing to do is uninstall from the Control Panel. Then, re-install. Finally, you need to delete your old data files (camera, area). The data files delete is caused by a couple of things, primarily changes in the types of data being installed. If you have the latest version MQTT will be there (under the Tools menu and when you define area notifications). I will also double check to make sure that the Release version on GitHub is correct.

The data files are at something like: C:\Users\username\AppData\Local\VirtualStore\Program Files (x86)\On Guard\On Guard \ -- change username to your user name. I do intend to relocate the data files to someplace at least slightly easier to get to. However, the way Windows works (due to security concerns) limits the number of places I can store data.