core icon indicating copy to clipboard operation
core copied to clipboard

Multiple Cameras Adding under one Device Still an Issue.

Open Mark-Longley opened this issue 1 year ago • 30 comments

The problem

Hi, This was raised as an issue a week or so back and closed following the last update. However it seems to still be causing problems for some users. I currently have 14 Reolink cameras attached. But the integration only adds 12 devices. 1 one the devices contains the entity's for 3 cameras. Plus some odd additional Entities? by odd additional ones there are 4 copies of some entities but 3 for others ?? see screen shots. I've also attached logs.

Thanks

What version of Home Assistant Core has the issue?

2025.4.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Reolink

Link to integration documentation on our website

No response

Diagnostics information

config_entry-reolink-01JS7PVWX1R5MEEQ0VX9CVK6CK.json

Example YAML snippet


Anything in the logs that might be useful for us?


Additional information

Image Image

Mark-Longley avatar Apr 24 '25 13:04 Mark-Longley

Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of reolink can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign reolink Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

home-assistant[bot] avatar Apr 24 '25 13:04 home-assistant[bot]

Same problem here! I have the NRV System with 8 Cameras installed. the Doorbell, PoE Cams and the Indoor WLAN cam are listed separately. Now I have added a new WLAN outdoorcam and it also recognized as a new device. Today I added another WLAN outdoorcam (the same device) and it's combined as one device with the other outdoorcam.

IP0rTeR avatar Apr 24 '25 21:04 IP0rTeR

I am also haviong this issue - I have the wifi doorbell camera, a wifi DUO camera and 2 poe cameras all linked through the NVR. Both of the PoE cameras show in the same device in home assistant

Paper-Jye avatar Apr 25 '25 08:04 Paper-Jye

Am having the same problem -- entities from several cameras attributed to a single camera.

Additionally, the NVR device only shows five entities, three of which are cameras, though the NVR actually has six cameras configured.

pfurrie avatar Apr 26 '25 10:04 pfurrie

I'm also having the same problem -- entities from several cameras attributed to a single camera. NVR shows each camera individually.

buckbren avatar Apr 27 '25 02:04 buckbren

I have the exact same issue also. It's combining my PoE doorbell with the Duo Floodlight WiFi.

Running HA on Raspberry Pi 4, HA core 2025.4.4. Reolink NVR RLN36, firmware v3.5.1.356_24110148.

I've tried deleting and re-adding the integration but the same issue occurred (with the same cameras)

jws123-Git avatar Apr 27 '25 10:04 jws123-Git

@jws123-Git could you try removing the integration, restarting HomeAssistant, only after the full restart of HA, add the integration again?

starkillerOG avatar Apr 27 '25 23:04 starkillerOG

It was a issue I accidentally introduced concerning the MAC of IPC cams connected to a NVR. I fixed this in HA 2025.4.3, but once the device has the wrong mac/device identifier assigned, the device Registry is messed up.

If you remove the integration and re-add it will remember the device and the issue persists. So we need the device registry to be cleaned/purged. I think this happens during a full restart of HA.

starkillerOG avatar Apr 27 '25 23:04 starkillerOG

Sorry for the late response, currently on vacation. Will be back end this week.

starkillerOG avatar Apr 27 '25 23:04 starkillerOG

I am having this same issue and tonight I tried removing the Reolink integration, rebooting HA, then re-adding the integration. I linked it through my NVR which is how I had it hooked up before. It only seemed to pull in one of my cameras instead of the 9 devices I actually have (which includes the NVR itself that used to be pulled in as its own device). On the plus side, the entities on the one device it did pull in only belong to that camera.

alux35 avatar Apr 28 '25 01:04 alux35

Looking in the logs I am seeing these log lines for the Reolink integration

Image

Here is the contents of one of the errors for the camera domain

Logger: homeassistant.components.camera Source: helpers/entity_platform.py:633 integration: Camera (documentation, issues) First occurred: 8:50:39 PM (112 occurrences) Last logged: 9:35:33 PM

Error adding entity None for domain camera with platform reolink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 633, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 822, in _async_add_entity device = dev_reg.async_get(self.hass).async_get_or_create( config_entry_id=self.config_entry.entry_id, config_subentry_id=config_subentry_id, **device_info, ) File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 885, in async_get_or_create device = self.async_update_device( device.id, ...<17 lines>... via_device_id=via_device_id, ) File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1170, in async_update_device self.devices[device_id] = new ~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/registry.py", line 42, in setitem self._unindex_entry(key, entry) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 648, in _unindex_entry self._unindex_entry_value(key, area_id, self._area_id_index) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/registry.py", line 56, in _unindex_entry_value del entries[key] ~~~~~~~^^^^^ KeyError: 'redacted'

alux35 avatar Apr 28 '25 02:04 alux35

It was a issue I accidentally introduced concerning the MAC of IPC cams connected to a NVR. I fixed this in HA 2025.4.3, but once the device has the wrong mac/device identifier assigned, the device Registry is messed up.

If you remove the integration and re-add it will remember the device and the issue persists. So we need the device registry to be cleaned/purged. I think this happens during a full restart of HA.

@starkillerOG Thanks for replying while you are on vacation.

I tried deleting the integration, did a full reboot and then re-added the NVR, but it's done the exact same thing, 1 entity for Duo and Doorbell.

jws123-Git avatar Apr 28 '25 06:04 jws123-Git

@jws123-Git which HA version are you on?

starkillerOG avatar Apr 28 '25 08:04 starkillerOG

@alux35 very interesting, not sure what is going on yet. But a error is always good, then at least I know where to look. Could you enable debug logging for reolink, reload the reolink integration, wait 3 minutes, disable debug logging and then post the resulting debug.log file here?

starkillerOG avatar Apr 28 '25 08:04 starkillerOG

@jws123-Git which HA version are you on?

@starkillerOG 2025.4.4

jws123-Git avatar Apr 28 '25 09:04 jws123-Git

@starkillerOG do you know of a better way to clear the device registry after I've removed the integration, other than just restart? Perhaps this is the issue?

jws123-Git avatar Apr 28 '25 09:04 jws123-Git

@starkillerOG here is the debug log file. I will also be looking at alternative ways to clear the device registry to see if that works too

home-assistant_reolink_2025-04-28T10-51-35.779Z.log

alux35 avatar Apr 28 '25 10:04 alux35

I remembered that I had some history stats linked to some of the entities from the cameras that I thought may be messing with things being recreated so I removed those and did the remove reolink integration, restart HA, then re-add integration again and this time it created no devices, but it did seem to create entities for two of my devices. They were not connected to any devices at first but coming back to it a number of minutes later after looking at some of the logs I can see the devices exist for those entities now, but I am still missing my other 7 devices and their entities. Below is another debug log that I made after all of this.

home-assistant_reolink_2025-04-28T13-54-44.496Z.log

alux35 avatar Apr 28 '25 14:04 alux35

I eventually got mine working, but the process is not for the feint of heart when it comes to messing with your HA core files. I'll put my process below in case anyone wants to follow it.

  1. Have access to the HA core.device_registry and core.entity_registry files. I have HAOS installed on its own box so I access it via the Advanced SSH and Web Terminal Add-On.
  2. Remove the Reolink integration
  3. Navigate to the location of the files (in HAOS they are in /config/.storage
  4. Make a backup of both files. No really, do it.
  5. Edit each of the files and remove any and all references to any device and entity that was created by reolink. I used the built in nano editor. I also did a search for reolink as there is typically a "platform" attribute on each line that in my case pointed to reolink.
  6. If any of the lines you removed are at the end of the list, make sure none of the items at the end of the list have trailing commas on them as it will cause a parsing error on start up, ask me how I know. If you don't know what this means then you should probably not be doing this.
  7. Restart HA
  8. If you run into any startup errors with a critical error showing parsing errors in one of the files you edited then figure out where you went wrong according to the error and restore your backup if needed
  9. If all was successful with the restart, re-add the Reolink integration After I did all of this Reolink added all 9 of my expected devices with their own entities.

alux35 avatar Apr 28 '25 15:04 alux35

I remembered that I had some history stats linked to some of the entities from the cameras that I thought may be messing with things being recreated so I removed those and did the remove reolink integration, restart HA, then re-add integration again and this time it created no devices, but it did seem to create entities for two of my devices. They were not connected to any devices at first but coming back to it a number of minutes later after looking at some of the logs I can see the devices exist for those entities now, but I am still missing my other 7 devices and their entities. Below is another debug log that I made after all of this.

home-assistant_reolink_2025-04-28T13-54-44.496Z.log

Thanks! This also helped me figure out what my problem was. I have my router (Mikrotik) integration added, which also added the devices as entities! I removed that and the Reolink integration, rebooted, re-added the Reolink integration and it's now showing the cameras as separate devices.

However, it doesn't show the NVR itself (I'm sure it should, right? I can't remember if it did previously)

Edit: Looks like I had a similar issue with my network switch integration also holding onto the NVR entity, I removed that and can now see all cameras and the NVR as separate devices.

jws123-Git avatar Apr 28 '25 15:04 jws123-Git

Thanks for making a new thread. I am still having the same issue. My Duo floodlight is combined with the Doorbell PoE

volfan996 avatar Apr 28 '25 17:04 volfan996

Same problem.

nsakelsek avatar May 08 '25 06:05 nsakelsek

avec have 6 camera and 4 devices , same issue 3 camera under 1 single device

jluc2808 avatar May 08 '25 11:05 jluc2808

The HA 2025.5.1 patch release should help resolve at least some of these issues.

Could you please let me know if your issue is fixed or not after upgrading to HA 2025.5.1?

starkillerOG avatar May 09 '25 15:05 starkillerOG

The HA 2025.5.1 patch release should help resolve at least some of these issues.

Could you please let me know if your issue is fixed or not after upgrading to HA 2025.5.1?

Just upgraded to 2025.5.1, and still an issue for me.

Edit: I did see in the PR you stating about rebooting to reset the registry for one device at a time. I did this multiple times and yielded no changes.

Image

ShadyBrk avatar May 09 '25 19:05 ShadyBrk

Upgraded to 2025.5.1 and I still have the issue.

buckbren avatar May 10 '25 02:05 buckbren

same as @buckbren, 2025.5.1 installed, rebooted 4 time, rebuilt 3 time, still have 4 devices in HA rather than 6 cameras do we have to deleted the integration first, restart, then re-add the integration ?

NB: I don't know if this could be an usefull info, but the initialization of Reolink integration (at each start or rebuilt) is very, very long much more than 2 or 3 minutes, till the initialization message go to state stable.

jluc2808 avatar May 10 '25 05:05 jluc2808

Still, same issue. Done same things as @jluc2808 .

nsakelsek avatar May 10 '25 06:05 nsakelsek

Update: I eventually got mine working by editing the core registry file as per alux35 comment. It did take about 36hours and 5 reboots for all cameras to be discovered? I also found one camera didn't have rtsp enabled, which was discovered as soon as I enabled it, so not sure if that was causing the slow discovery?

Mark-Longley avatar May 10 '25 06:05 Mark-Longley

This is my latest attempt to fix the issue: https://github.com/home-assistant/core/pull/144771 It will probably be included in HA 2025.5.2 schedualed for May 16th.

starkillerOG avatar May 12 '25 20:05 starkillerOG