JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
947 stars 80 forks source link

Unexpected error fetching Tapo resource status data #561

Open RentreX opened 2 months ago

RentreX commented 2 months ago

Description

Receiving this error message:

Logger: custom_components.tapo_control
Source: helpers/update_coordinator.py:315
integration: Tapo: Cameras Control ([documentation](https://github.com/JurajNyiri/HomeAssistant-Tapo-Control), [issues](https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues))
First occurred: 09:38:01 (51 occurrences)
Last logged: 09:50:31

Unexpected error fetching Tapo resource status data: 'bool' object has no attribute 'started'

Reproduction Steps

Error in the Home Assistant logs

Expected behavior

No errors

If applicable, add error logs.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 271, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/__init__.py", line 380, in async_update_data
    await setupEvents(hass, entry)
  File "/config/custom_components/tapo_control/utils.py", line 1214, in setupEvents
    if not hass.data[DOMAIN][config_entry.entry_id]["events"].started:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'started'

Device Firmware

1.3.11 Build 231117 Rel.47346n(4555)

Integration Version

5.4.17PSA

Using stream component

No

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Core 2024.4.2

Search for similar issues

Yes

Additional information

I have searched the Github and seen other issues that are close to this issue though from what I could see all the other issues are related to "object is not subscriptable"

I am happy to email the debug log if needed.

Morphy99 commented 1 month ago

Same here with a C200 on Firmware: 1.3.6 Build 230424 Rel.77225n(4555)

DrakenXI commented 1 month ago

I fixed this issue with this little modification in utils.py line 1227 : if not isinstance(hass.data[DOMAIN][config_entry.entry_id]["events"], (bool)) and not hass.data[DOMAIN][config_entry.entry_id]["events"].started: