Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: object has no attribute '_webrtc_provider' #778

Open
tjorim opened this issue Oct 30, 2024 · 12 comments
Open

AttributeError: object has no attribute '_webrtc_provider' #778

tjorim opened this issue Oct 30, 2024 · 12 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@tjorim
Copy link

tjorim commented Oct 30, 2024

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)

  • Model Name [e.g. dreame.vacuum.p2028]: n/a
  • Firmware Version [e.g. 1156]: n/a
  • Home Assistant Version: 2024.11
  • Configuration Type [With or without map support]: with map
  • Errors or warnings shown in the HA logs (if applicable):
Logger: homeassistant.components.camera
Source: helpers/entity_platform.py:599
integration: Camera (documentation, issues)
First occurred: 20:54:52 (3 occurrences)
Last logged: 20:54:59

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 home-assistant/core#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."

@tjorim tjorim added bug Something isn't working question Further information is requested labels Oct 30, 2024
@Tasshack
Copy link
Owner

Tasshack commented Nov 1, 2024

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

@melianor
Copy link

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
Copy link

taifunk commented Nov 12, 2024

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
Copy link

Hi @taifunk,

Thanks a lot, it is working.

@melianor
Copy link

_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
Copy link

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

@kovacsla
Copy link

kovacsla commented Nov 18, 2024

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

This is my version:

image

@auanasgheps
Copy link

auanasgheps commented Nov 18, 2024

Thanks, working!

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

@wernerhp
Copy link

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
Copy link

RykovDC commented Nov 23, 2024

The problem still persists on the Home Assistant Core 2024.11.3?

@alexsotoaguilera
Copy link

The problem still persists on the Home Assistant Core 2024.11.3?

yes

@kovacsla
Copy link

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:
#778 (comment)

taifunk added a commit to taifunk/dreame-vacuum that referenced this issue Nov 25, 2024
Added lines to resolve error
Tasshack#778
@taifunk taifunk mentioned this issue Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants