elad-bar / ha-blueiris

Integration with Blue Iris Video Security Software
179 stars 42 forks source link

Platform blueiris does not generate unique IDs #85

Open JOHLC opened 3 years ago

JOHLC commented 3 years ago

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

naseemr commented 3 years ago

I am also getting this error

elad-bar commented 3 years ago

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

JOHLC commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

mattbruman commented 3 years ago

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.

PistolaPeteUK commented 2 years ago

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 commented 2 years ago

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.

kramttocs commented 2 years ago

Is this still occurring?

nemec commented 2 years ago

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.

kramttocs commented 2 years ago

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.

nemec commented 2 years ago

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
djryan012 commented 2 years ago

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

Lepelot commented 2 years ago

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

bartbakels commented 2 years ago

Same issue here

shanebreckon commented 2 years ago

Also experiencing this issue.

nrpetonr commented 2 years ago

plus one here

RJ-Make commented 2 years ago

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

kramttocs commented 2 years ago

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.

floodwayprintco commented 2 years ago

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

prenetic commented 2 years ago

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.

kramttocs commented 2 years ago

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

dbs179 commented 2 years ago

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

prenetic commented 2 years ago

@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'
kramttocs commented 1 year ago

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

dbs179 commented 1 year ago

@kramttocs Yes I have MQTT installed and enabled.

kramttocs commented 1 year ago

@dbs179 And are you still seeing this error?

dbs179 commented 1 year ago

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

keithfree commented 1 year ago

I am seeing this issue as well. For each camera, I see one "Platform blueiris does not generate unique IDs...." line in the logs. The set of them appear so far on every restart of HA or reload of the BI integration.

quemart commented 1 year ago

I too have been getting this one error for a while. I have MQTT enabled. I also have BI autoupdates enabled.

Logger: homeassistant.components.binary_sensor Source: helpers/entity_platform.py:536 Integration: Binary sensor (documentation, issues) First occurred: 21:52:22 (4 occurrences) Last logged: 21:52:22

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