ha-blueiris icon indicating copy to clipboard operation
ha-blueiris copied to clipboard

Integration keeps appending "_2" to the end of the entities

Open PMaxx-Gaming opened this issue 2 years ago • 20 comments

My logs keep filling up with "Stream not found" errors and when I look at my entities in developer tools I'll see that all of my cameras have duplicate entities with the original one not working and the duplicate (with "_2" appended to the name) being tied to the integration.

This forces me to restart HA, reload the integration and then rename all of my cameras to remove the "_2" from the entity.

This happens more than once per day.

PMaxx-Gaming avatar Mar 02 '22 21:03 PMaxx-Gaming

Hey @PMaxx-Gaming , How long has this been happening? Have you been using the integration for awhile? Any thoughts as to what action is causing the duplicates? Are you making changes to the integration options? Thanks

kramttocs avatar Mar 02 '22 21:03 kramttocs

I've been using the integration for a year or so, and it's been happening for at least the past few months, I'm not really sure though. I haven't changed anything and can't figure out what seems to be causing it; I haven't had any issues with BI itself, just this integration.

PMaxx-Gaming avatar Mar 02 '22 21:03 PMaxx-Gaming

Thanks. I am not sure what would cause this but I'll look at how the entities are created and maybe something will stand out. Odd that I haven't seen it and I've been poking around with the integration pretty heavy the past couple of weeks. If you happen to play around and get it to create more duplicates, let me know.

kramttocs avatar Mar 02 '22 22:03 kramttocs

Looks similar to #111

kramttocs avatar Mar 02 '22 22:03 kramttocs

Will do. It seems to just happen randomly; sometimes restarting HA and then reloading the integration gets the feeds back on my dashboard, but I've had to reinstall the integration to get them back in the past. I just noticed the duplicates yesterday and realized that's why they weren't showing on my dashboard when this issue would pop up (because the working cameras had "_2" on the name, and my dashboard feeds did not).

PMaxx-Gaming avatar Mar 02 '22 22:03 PMaxx-Gaming

Yes, that looks like the same issue

PMaxx-Gaming avatar Mar 02 '22 22:03 PMaxx-Gaming

Oddly enough I noticed this happened to me this evening. Some observations: When it occurred I looked at Devices and all of the broken ones (no _X) showed an integration of Camera or Binary Sensor. The working ones (_2) shows Blue Iris NVR I did a Reload of the integration and the _2 ones disappeared and the no _X ones started working again.

Will keep looking at this one as that is pretty annoying especially if one sets the BI profile as part of their HA alarm system.

kramttocs avatar Mar 03 '22 06:03 kramttocs

I did a little digging this morning and noticed that I had "Stream not found" errors twice in my HA logs last night and at some point lost all of my camera feeds due to the duplicate issue. I checked my BI logs and roughly 60 seconds before the stream errors in HA my Blue Iris logs say "APP - Restarted after unexpected shutdown". This happened both times I had errors in HA

PMaxx-Gaming avatar Mar 03 '22 14:03 PMaxx-Gaming

Also, I just noticed the duplicate ("_2") streams have a different session ID and access token from the previously working streams (the ones without "_2").

PMaxx-Gaming avatar Mar 03 '22 14:03 PMaxx-Gaming

Good info. I added some logging to my test build last night but of course mine didn't show the issue. It does look like it does a lot of re-creating of the mqtt entities so I'll see if something can be done about that.

You are seeing the BI log message about the unexpected shutdown in the BI Status > Logs window?

kramttocs avatar Mar 03 '22 15:03 kramttocs

Status > Messages > Open File (I have log to file enabled)

PMaxx-Gaming avatar Mar 03 '22 15:03 PMaxx-Gaming

I've been having same issue for a while now. Any help would be grateful. If i can assist with anything let me know

thanls paul belfast

pjponymoore avatar Mar 04 '22 17:03 pjponymoore

Hey Paul, If you can find any pattern - either in HA or BI itself, that would be great. I see elad-bar made some changes in the new shinobi code that might help with this? I am going to try this weekend to see about porting those over.

kramttocs avatar Mar 04 '22 18:03 kramttocs

Thanks for speedy reply

I will try recreate issue today. i thought it was every time i restarted HA, like after updates etc, but not so sure now after a couple of forced restarts today. i have totally re installed blueiris components in HACS/HA this morning to see if this makes any difference. Thanks again for your reply

Paul Belfast

pjponymoore avatar Mar 05 '22 08:03 pjponymoore

Hey Paul, Can you manually copy the files from here: https://github.com/kramttocs/ha-blueiris/tree/changes-from-shinobi-repo and overwrite the ones in your HA instance? I pulled over some changes from elad-bar's Shinobi repo that I thought might be helpful. The piece of note are changes around deleting entities. I am wondering if that will have an impact on this behavior. I am not sure the original reason behind deleting the entities so often.

Do note that this has the changes from 1.0.11 (released today) in it which has an important note about the integration/server name.

Thanks!

kramttocs avatar Mar 06 '22 05:03 kramttocs

Hi Kramttocs

Done that this morning, After re-installing everything from scratch yestermorning, i couldn't reproduce error. I tried many HA restarts but still couldn't get it to rename entities. dunno if it was cause i re-setup hacs and integrations. Ill keep you upto date with how this performs with new files installed.

Again thanks for your time!!

paul

pjponymoore avatar Mar 06 '22 07:03 pjponymoore

I ended up having to reinstall the integration last night because all of my BI entities suddenly became unavailable, and no matter how many times I reloaded the integration and restarted Home Assistant, I couldn't get my Blue Iris entities to work

PMaxx-Gaming avatar Mar 06 '22 14:03 PMaxx-Gaming

Didn't happen to get a log, did you? Someone else reported similar so am concerned there is something going on with the changes in 1.0.11.

kramttocs avatar Mar 06 '22 14:03 kramttocs

I didn't, sorry. It was right before I went to sleep, but it happened before I installed the new update. 

PMaxx-Gaming avatar Mar 06 '22 14:03 PMaxx-Gaming

OK, keep me updated. 1.0.11 wasn't supposed to be a breaking change that required a reinstall.

kramttocs avatar Mar 06 '22 14:03 kramttocs