JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.14k stars 89 forks source link

'TapoMotionDetectionSelect' object has no attribute with version 4.1.3 #233

Closed masiko-jh closed 2 years ago

masiko-jh commented 2 years ago

Description

I have two cameras, C200 and C310. After updated to version 4.1.3, HA logs plenty attributeError related to 'TapoMotionDetectionSelect'

Reproduction Steps

updated version to 4.1.3

Expected behavior

no error logged

If applicable, add error logs.

2022-10-21 20:46:04.490 ERROR (MainThread) [custom_components.tapo_control] Unexpected error fetching Tapo resource status data: 'TapoMotionDetectionSelect' object has no attribute '_enabled' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/init.py", line 234, in async_update_data if entity._enabled: AttributeError: 'TapoMotionDetectionSelect' object has no attribute '_enabled'

Device Firmware

C200: 1.1.18 Build 220518 Rel.61472n(4555) - C310: v1.3.1 Build 220713 Rel.42087n(4555)

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Docker on NUC with Debian11

Search for similar issues

Yes

Additional information

No response

JurajNyiri commented 2 years ago

That doesn't make much sense, attribute should be there and I cannot replicate it.

What version did you upgrade from? Can you test in 4.1.2?

Try restarting Home Assistant and reinstalling the integration (updating the version or replacing files) and let me know if the issue persists.

masiko-jh commented 2 years ago

Hi.. I upgraded from v 4.1.2 to 4.1.3.. home assistant restarted as yoou requested, same error on log, restarted even NUC, error still show up on log updated to 4.1.4, same error ..

removed integration and reinstalled 4.1.4 from scratch added camera C200.. no error on log added camera C310 and error come up again..

I dont know, if I'm the only one with this problem maybe could be something related to my configuration.. I'll investigate more.. if I find something I'll let you know!

Thanks

JurajNyiri commented 2 years ago

I do not own C310 so I cannot test for it. 4.1.3 introduced a new way to get updates, so it might be possible it doesnt work properly on C310. Could you come to discord to debug?

JurajNyiri commented 2 years ago

Is there anything else in the logs? Try enabling debug logs and post everything up until that error.

JurajNyiri commented 2 years ago

Also please confirm the error goes away if you move back to 4.1.2, you can do this easily by HACS.

masiko-jh commented 2 years ago

v4.1.4 -- Removed camera C200 and configured only C310, debug enabled and restarted HA

debug__log_4.1.4.txt i'm trying to move back to 4.1.2..

JurajNyiri commented 2 years ago

This was helpful, I can see that for some reason the TapoMotionDetectionSelect does not finish initialization, even though there is no error which is very weird.

I have pushed a new version into the github, please download it and overwrite files manually. Then send debug logs again.

If it works, you should see something like this:

2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] Creating TapoMotionDetectionSelect
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - start
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - append
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - update
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 1
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 3
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 5
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] TapoMotionDetectionSelect updateTapo 6
2022-10-21 22:32:02.725 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoMotionDetectionSelect to: high
2022-10-21 22:32:02.726 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - TapoEntity
2022-10-21 22:32:02.726 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - SelectEntity
2022-10-21 22:32:02.726 DEBUG (MainThread) [custom_components.tapo_control] Tapo Motion Detection - init - end
2022-10-21 22:32:02.726 DEBUG (MainThread) [custom_components.tapo_control] Adding TapoMotionDetectionSelect...

Yours will probably stop somewhere else but that will tell me more about what is going on. In any case, make sure to post the full log.

masiko-jh commented 2 years ago

done.. here is the full log.. debug__log_main.txt

JurajNyiri commented 2 years ago

I see the issue, the 'motion_detection_sensitivity': None. That should never happen.

I added one more log could you download again and run?

JurajNyiri commented 2 years ago

The latest version I just pushed to github (not yet released) has a fix for this. But please do still post the full debug log with it, I need to know how your camera got into that state it should never be in so that I can fix it better.

masiko-jh commented 2 years ago

now seem fixed.. error is gone

debug__log_last.txt

..just runned more test with older versions to find exactly when error occurred:

Thanks

vingerha commented 2 years ago

Have had the same TapoMotionDetectionSelect issue with a C310 after/with recent many updates (I was on 3.72 recently) Just installed 'main' and the error no longer shows.

JurajNyiri commented 2 years ago

Hot fixed for 4.1.5 I will fix it better (so that it gets correct value) in next version by tomorrow. Thank you for the logs!