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

Platform blueiris does not generate unique IDs

Open JOHLC opened this issue 3 years ago • 30 comments

Error logged in home assistant: Logger: homeassistant.components.binary_sensor Source: helpers/entity_platform.py:473 Integration: Binary sensor (documentation, issues) First occurred: 2:11:28 PM (5 occurrences) Last logged: 2:11:28 PM

Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts

System info: Home Assistant 0.115.3

JOHLC avatar Sep 27 '20 18:09 JOHLC

I am also getting this error

naseemr avatar Oct 20 '20 15:10 naseemr

since when it began? is it the only non-unique entity that was created or others as well? can you post the log in debug level for that component? (the relevant message are part of startup of HA so you will need also to restart the HA)

you can set the log level from integration's options of the component

thanks

elad-bar avatar Oct 24 '20 14:10 elad-bar

Hello, this began around version 116 I think I will try and get a log but im sure it has to do with new Home Assistant versions requesting unique IDs being required. Something as simple as adding unique_id: cameraname Might be what fixes this. Then we could also customize these entities in the Customize config menu

JOHLC avatar Nov 05 '20 17:11 JOHLC

Here are the logs

2020-11-05 12:48:31 DEBUG (MainThread) [custom_components.blueiris.binary_sensors.main] Received BlueIris Message - BlueIris/Basement/Status: { "type": "MOTION_ABC", "trigger": "OFF" }
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:31 DEBUG (MainThread) [custom_components.blueiris.binary_sensors.base] BlueIris Living room camera Motion updated from False to True
2020-11-05 12:48:31 DEBUG (MainThread) [custom_components.blueiris.binary_sensors.main] BlueIris Alerts updated from False to True
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:31 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts
2020-11-05 12:48:38 DEBUG (MainThread) [custom_components.blueiris.binary_sensors.main] Received BlueIris Message - BlueIris/LRCAM/Status: { "type": "MOTION_ABC", "trigger": "OFF" }

JOHLC avatar Nov 05 '20 17:11 JOHLC

Although I am not good with python myself, this may help https://developers.home-assistant.io/docs/config_entries_config_flow_handler#unique-ids

JOHLC avatar Mar 10 '21 00:03 JOHLC

Having the issue as well but after a reboot it creates all my cameras again and renames them as XXXX_2 which then orphans the OG cameras and then on another reboot it creates the cameras again as the OG names and orphans the XXXX_2 cams. I have to keep fixing my automations or I have to reboot twice.

mattbruman avatar Jun 04 '21 13:06 mattbruman

Anyone solve / find a workaround for the devices & entities names reverting back? I have tried to add unique_ids via the Customization and that seemed to work for a while and then it stopped, and I thought unticking "generate config files" worked for a much longer time but today they've reverted again.

PistolaPeteUK avatar Sep 17 '21 13:09 PistolaPeteUK

In case anyone is having the same issue I was, I have worked it out....well at least what is causing the problem. I had some time to look back through my HA database to see when the entities and devices were changing name and it co-indecided with Blue Iris automatic updates. It seems when Blue Iris updated, the device/entities revert back to their default names.

I have turned off auto updates and it's been stable for 2 /12 weeks now. I will just manually update BI when needed and quickly fix the stuff in HA.

PistolaPeteUK avatar Oct 07 '21 10:10 PistolaPeteUK

Is this still occurring?

kramttocs avatar Mar 01 '22 06:03 kramttocs

I still get this exact error in v1.0.10 (and have received it for a while). I don't have any alerts configured in BI.

nemec avatar Mar 04 '22 20:03 nemec

Can you provide some logs? Is BI uodating/restarting/going offline/etc right before it happens? If you can find some pattern that would allow me to recreate, happy to see if I can fix it.

kramttocs avatar Mar 05 '22 00:03 kramttocs

It happens reliably every time I reboot Home Assistant. I'm not touching Blue Iris and not aware of the issue happening aside from at startup. Camera streams provided by integration work fine. Here are my logs from the recent boot - I'm pretty sure KeyError: 'mqtt' is a different integration issue (I don't have mqtt installed). If you need data from a BI API call, let me know the URL path and I'll see if I can fetch it.

2022-03-04 20:19:48 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entities for domain binary_sensor with platform blueiris
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 747, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/home/homeassistant/.homeassistant/custom_components/blueiris/models/base_entity.py", line 102, in async_added_to_hass
    await self.async_added_to_hass_local()
  File "/home/homeassistant/.homeassistant/custom_components/blueiris/binary_sensors/main.py", line 59, in async_added_to_hass_local
    self.remove_subscription = await async_subscribe(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/mqtt/__init__.py", line 378, in async_subscribe
    async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'
2022-03-04 20:19:49 WARNING (MainThread) [alexapy.alexawebsocket] mac_dms not detected; websocket likely won't connect
2022-03-04 20:19:50 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 747, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/home/homeassistant/.homeassistant/custom_components/blueiris/models/base_entity.py", line 102, in async_added_to_hass
    await self.async_added_to_hass_local()
  File "/home/homeassistant/.homeassistant/custom_components/blueiris/binary_sensors/main.py", line 59, in async_added_to_hass_local
    self.remove_subscription = await async_subscribe(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/mqtt/__init__.py", line 378, in async_subscribe
    async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'
2022-03-04 20:19:51 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/discovery_flow.py", line 74, in _async_process_pending_flows
    await gather_with_concurrency(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/util/async_.py", line 170, in gather_with_concurrency
    return await gather(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/util/async_.py", line 168, in sem_task
    return await task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 203, in async_init
    flow, result = await task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 230, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data, init_done)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 325, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/hue/config_flow.py", line 231, in async_step_ssdp
    self.bridge = await self._get_bridge(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/hue/config_flow.py", line 71, in _get_bridge
    bridge = await discover_bridge(
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohue/discovery.py", line 35, in discover_bridge
    bridge_id = await is_hue_bridge(host, websession)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohue/discovery.py", line 82, in is_hue_bridge
    return normalize_bridge_id(data["bridgeid"])
KeyError: 'bridgeid'
2022-03-04 20:20:18 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts

nemec avatar Mar 05 '22 00:03 nemec

Also have had this error for a long time. Current message in my logs

Logger: homeassistant.components.binary_sensor Source: helpers/entity_platform.py:593 Integration: Binary sensor (documentation, issues) First occurred: 10:52:54 PM (2 occurrences) Last logged: 10:52:54 PM

Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-BlueIris Alerts is already used by binary_sensor.blueiris_alerts - ignoring binary_sensor.blueiris_alerts

djryan012 avatar Mar 12 '22 06:03 djryan012

I have also had this error for a long time. I noticed it is repeating 7 times at every HA restart:

2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts 2022-03-12 12:31:13 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform blueiris does not generate unique IDs. ID blueiris-binary_sensor-MAIN-Salambo Alerts is already used by binary_sensor.salambo_alerts - ignoring binary_sensor.salambo_alerts

Lepelot avatar Mar 12 '22 12:03 Lepelot

Same issue here

bartbakels avatar Apr 06 '22 15:04 bartbakels

Also experiencing this issue.

shanebreckon avatar Apr 16 '22 04:04 shanebreckon

plus one here

nrpetonr avatar Apr 18 '22 08:04 nrpetonr

I've always seen this error. For over 6 months :-) .

RJ-Make avatar Apr 18 '22 13:04 RJ-Make

Odd that some have this and some don't (like myself). Did some looking into this a couple days ago and have an idea that might help. Will test it out when I am able.

kramttocs avatar Apr 18 '22 14:04 kramttocs

I still have this issue and not sure what it could be from.

floodwayprintco avatar May 11 '22 15:05 floodwayprintco

Still having this issue. It also seems to cause every disabled device/entity providing useless data to come back after a reboot, and devices are also losing their relationship with their configured area so dashboards lose camera feeds too. This is a pretty major usability problem.

prenetic avatar May 31 '22 18:05 prenetic

@prenetic Can you take a look at the linked issue from @nemec ? Are you seeing the same with mqtt?

kramttocs avatar Jun 03 '22 04:06 kramttocs

I too have this issue. It only occurs on a restart of HA and everything works as it should.

dbs179 avatar Jun 28 '22 13:06 dbs179

@prenetic Can you take a look at the linked issue from @nemec ? Are you seeing the same with mqtt?

Yes actually, this output looks the same as the linked issue and also occurs while restarting Home Assistant. I'm not using MQTT for any reason (that I'm aware of) in my setup either. I'm running a plain HAOS virtual appliance with all the latest updates.

Logger: homeassistant.components.binary_sensor
Source: components/mqtt/client.py:198
Integration: Binary sensor ([documentation](https://www.home-assistant.io/integrations/binary_sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+binary_sensor%22))
First occurred: June 27, 2022, 2:40:00 PM (1 occurrences)
Last logged: June 27, 2022, 2:40:00 PM

Error adding entities for domain binary_sensor with platform blueiris
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 809, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/blueiris/models/base_entity.py", line 102, in async_added_to_hass
    await self.async_added_to_hass_local()
  File "/config/custom_components/blueiris/binary_sensors/main.py", line 59, in async_added_to_hass_local
    self.remove_subscription = await async_subscribe(
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 198, in async_subscribe
    async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'

prenetic avatar Jun 28 '22 20:06 prenetic

@dbs179 Do you have mqtt installed/enabled on your instance?

kramttocs avatar Dec 05 '22 07:12 kramttocs

@kramttocs Yes I have MQTT installed and enabled.

dbs179 avatar Dec 05 '22 13:12 dbs179

@dbs179 And are you still seeing this error?

kramttocs avatar Dec 05 '22 13:12 kramttocs

@kramttocs Yes, I just did a restart to confirm and I am still seeing the error message.

dbs179 avatar Dec 05 '22 14:12 dbs179