Tasshack / dreame-vacuum

Home Assistant integration for Dreame robot vacuums with map support
https://community.home-assistant.io/t/custom-component-dreame-vacuum
MIT License
894 stars 112 forks source link

AttributeError: object has no attribute '_webrtc_provider' #778

Open tjorim opened 3 weeks ago

tjorim commented 3 weeks ago

Describe the bug Getting the following webrtc error since the introduction in HA 2024.11

To Reproduce Update HA core to 2024.11.0b0 and check the logs.

Expected behavior No errors in the log.

Additional Information (please complete the following information)

Error adding entity camera.d10s_pro_map for domain camera with platform dreame_vacuum Error adding entity camera.d10s_pro_map_1 for domain camera with platform dreame_vacuum Error adding entity camera.d10s_pro_map_2 for domain camera with platform dreame_vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish await self.async_internal_added_to_hass() File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 782, in async_internal_added_to_hass await self.async_refresh_providers(write_state=False) File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 790, in async_refresh_providers old_provider = self._webrtc_provider ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'



Confirmed as not a core issue https://github.com/home-assistant/core/issues/129532.
"The issue is in the CC not initializing the Camera Entity by calling the parent class init method when defining its own init method."
Tasshack commented 3 weeks ago

Not calling the parent class init function is very much intentional but I cannot remember the actual reason behind it.

melianor commented 1 week ago

Hi @Tasshack , Your comment below referenced issue #779 and in the issue itself, sounds a bit like #779 will not be merged. Could you please clarify? Should it be closed, will this update also make it into the next pre-release version?

Thanks a lot for all your efforts and the pre-release version for the new Dreame vacuuums Cheers, Mel

taifunk commented 1 week ago

To resolve the issue temporarily, I added the missing attributes to the DreameVacuumCameraEntity class in the camera.py file of the integration. Specifically, I added the following lines to the class:

_webrtc_provider = None
_legacy_webrtc_provider = None
_supports_native_sync_webrtc = False
_supports_native_async_webrtc = False

After adding these attributes, the errors stopped appearing in the logs, and the integration started working as expected.

kovacsla commented 1 week ago

Hi @taifunk,

Thanks a lot, it is working.

melianor commented 1 week ago

_webrtc_provider = None _legacy_webrtc_provider = None _supports_native_sync_webrtc = False _supports_native_async_webrtc = False

Hi @taifunk, thanks that worked nicely. Maybe this can make it into a future release?

auanasgheps commented 6 days ago

Hi there, can you please tell exactly where I should add those values in the camera.py file?

kovacsla commented 6 days ago

Hi there, can you please tell exactly where I should add those values in the camera.py file?

This is my version:

image

auanasgheps commented 6 days ago

Thanks, working!

@taifunk since you deserve the credit, you should create a PR to fix this

wernerhp commented 1 day ago

Dreame L10 Prime doesn't have a camera.

2024-11-23 17:56:15.455 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'
2024-11-23 17:56:15.487 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map_data for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'
2024-11-23 17:56:19.159 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map_1 for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'
RykovDC commented 19 hours ago

The problem still persists on the Home Assistant Core 2024.11.3?

alexsotoaguilera commented 19 hours ago

The problem still persists on the Home Assistant Core 2024.11.3?

yes

kovacsla commented 10 hours ago

Dreame L10 Prime doesn't have a camera.

2024-11-23 17:56:15.455 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'
2024-11-23 17:56:15.487 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map_data for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'
2024-11-23 17:56:19.159 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.dreamebot_l10_prime_map_1 for domain camera with platform dreame_vacuum
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1366, in add_to_platform_finish
    await self.async_internal_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 791, in async_internal_added_to_hass
    await self.async_refresh_providers(write_state=False)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 799, in async_refresh_providers
    old_provider = self._webrtc_provider
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DreameVacuumCameraEntity' object has no attribute '_webrtc_provider'

This is the solution: https://github.com/Tasshack/dreame-vacuum/issues/778#issuecomment-2471687143