JurajNyiri / HomeAssistant-Tapo-Control

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

Continued Re-Authentication Required After Restart #465

Closed kksligh closed 7 months ago

kksligh commented 7 months ago

Description

Pretty consistently, every time I restart HA, i have to reauthenticate 1 of my 3 Tapo cameras. It tends to be the C225 model most often, but I have seen it happen with the C211 model as well. Here are the devices I have:

Camera 1

Camera 2

Camera 3

Reproduction Steps

Restart HA Re-authentication is required

Expected behavior

Do not have to re-authenticate after each restart

If applicable, add error logs.

I have debug on, but I tried to just pull the items labeled error because its a lot of lines

The error log below is when the model C225 had to re-authenticate

Logger: homeassistant.config_entries Source: config_entries.py:402 First occurred: 10:30:13 AM (10 occurrences) Last logged: 10:30:13 AM

Error setting up entry 172.16.0.102 for select Error setting up entry 172.16.0.102 for siren Error setting up entry 172.16.0.102 for update Error setting up entry 172.16.0.102 for binary_sensor Error setting up entry 172.16.0.102 for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 440, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup!

This error originated from a custom integration.

Logger: custom_components.tapo_control Source: custom_components/tapo_control/init.py:770 Integration: Tapo: Cameras Control (documentation, issues) First occurred: 10:29:31 AM (1 occurrences) Last logged: 10:29:31 AM

Unable to connect to Tapo: Cameras Control controller: Invalid authentication data

DEBUG

23-11-18 10:29:30.295 DEBUG (SyncWorker_13) [custom_components.tapo_control] [pytapo] {'result': {'responses': [{'method': 'getDeviceInfo', 'result': {'device_info': {'basic_info': {'device_type': 'SMART.IPCAMERA', 'device_info': 'C225 1.0 IPC', 'features': 3, 'barcode': '', 'device_model': 'C225', 'sw_version': '1.0.24 Build 230731 Rel.42636n', 'device_name': 'C225 1.0', 'hw_version': '1.0', 'device_alias': 'Camera 3 - Tapo', 'mobile_access': '0', 'mac': '48-22-54-34-C2-2C', 'dev_id': '80213D565474746F25DFC1079D2B399D2110DBA3', 'hw_id': 'B542E565772E9BDB19D341DCCDC4089A', 'oem_id': '259BA08F62E7218E8BC39FAC0A2135F8', 'hw_desc': '00000000000000000000000000000000', 'manufacturer_name': 'TP-LINK', 'ffs': False, 'is_cal': True, 'avatar': 'camera c225', 'has_set_location_info': 1, 'longitude': -867961, 'latitude': 358888, 'no_rtsp_constrain': 1}}}, 'error_code': 0}, {'method': 'getDetectionConfig', 'result': {'motion_detection': {'motion_det': {'enabled': 'on', 'sensitivity': 'medium', 'digital_sensitivity': '60', 'people_enabled': 'off', 'vehicle_enabled': 'off', 'non_vehicle_enabled': 'off'}}}, 'error_code': 0}, {'method': 'getPersonDetectionConfig', 'result': {'people_detection': {'detection': {'enabled': 'on', 'sensitivity': '60'}}}, 'error_code': 0}, {'method': 'getVehicleDetectionConfig', 'result': {'vehicle_detection': {'detection': {'enabled': 'off', 'sensitivity': '60'}}}, 'error_code': 0}, {'method': 'getBCDConfig', 'result': {'sound_detection': {'bcd': {'enabled': 'off', 'sensitivity': 'medium', 'digital_sensitivity': '50'}}}, 'error_code': 0}, {'method': 'getPetDetectionConfig', 'result': {'pet_detection': {'detection': {'enabled': 'off', 'sensitivity': '60'}}}, 'error_code': 0}, {'method': 'getBarkDetectionConfig', 'result': {'bark_detection': {'detection': {'enabled': 'off', 'sensitivity': '50'}}}, 'error_code': 0}, {'method': 'getMeowDetectionConfig', 'result': {'meow_detection': {'detection': {'enabled': 'off', 'sensitivity': '50'}}}, 'error_code': 0}, {'method': 'getGlassDetectionConfig', 'result': {'glass_detection': {'detection': {'enabled': 'off', 'sensitivity': '50'}}}, 'error_code': 0}, {'method': 'getTamperDetectionConfig', 'result': {'tamper_detection': {'tamper_det': {'enabled': 'off', 'sensitivity': 'medium', 'digital_sensitivity': '50'}}}, 'error_code': 0}, {'method': 'getLensMaskConfig', 'result': {'lens_mask': {'lens_mask_info': {'enabled': 'off'}}}, 'error_code': 0}, {'method': 'getLdc', 'result': {'image': {'switch': {'schedule_end_time': '64800', 'schedule_start_time': '21600', 'clear_licence_plate_mode': 'off', 'switch_mode': 'common', 'rotate_type': 'off', 'flip_type': 'off', 'ldc': 'off', 'night_vision_mode': 'inf_night_vision', 'full_color_people_enhance': 'off', 'full_color_min_keep_time': '30', 'wtl_intensity_level': '5', 'wtl_force_time': '300', 'overexposure_people_suppression': 'off', 'best_view_distance': '0', 'image_scene_mode': 'normal', 'image_scene_mode_common': 'normal', 'image_scene_mode_shedday': 'normal', 'image_scene_mode_shednight': 'normal', 'image_scene_mode_autoday': 'normal', 'image_scene_mode_autonight': 'normal'}, 'common': {'chroma': '50', 'luma': '50', 'sharpness': '50', 'saturation': '50', 'contrast': '50', 'inf_delay': '5', 'wd_gain': '50', 'exp_gain': '100', 'smartir_level': '0', 'auto_exp_gain_max': '0', 'wb_R_gain': '50', 'wb_B_gain': '50', 'wb_G_gain': '50', 'wtl_sensitivity': '4', 'wtl_delay': '5', 'wtl_sensitivity_day2night': '1400', 'wtl_sensitivity_night2day': '9100', 'iris_level': '160', 'lock_red_gain': '0', 'lock_gr_gain': '0', 'lock_gb_gain': '0', 'lock_blue_gain': '0', 'lock_red_colton': '0', 'lock_green_colton': '0', 'lock_blue_colton': '0', 'focus_limited': '10', 'inf_start_time': '64800', 'inf_end_time': '21600', 'wtl_start_time': '64800', 'wtl_end_time': '21600', 'inf_sensitivity_day2night': '1400', 'inf_sensitivity_night2day': '9100', 'wide_dynamic': 'off', 'high_light_compensation': 'off', 'dehaze': 'off', 'eis': 'off', 'auto_exp_antiflicker': 'off', 'inf_type': 'auto', 'inf_sensitivity': '4', 'wtl_type': 'auto', 'backlight': 'off', 'area_compensation': 'default', 'smartir': 'auto_ir', 'exp_type': 'auto', 'exp_level': '0', 'shutter': '1/25', 'style': 'original', 'focus_type': 'manual', 'wb_type': 'auto', 'lock_source': 'local', 'smartwtl': 'auto_wtl', 'smartwtl_level': '3', 'smartwtl_digital_level': '50', 'light_freq_mode': 'auto'}}}, 'error_code': 0}, {'method': 'getLastAlarmInfo', 'result': {'msg_alarm': {'chn1_msg_alarm_info': {'enabled': 'off', 'light_alarm_enabled': 'on', 'alarm_mode': ['light', 'sound'], 'alarm_type': '0', 'light_type': '1', 'sound_alarm_enabled': 'on', 'alarm_volume': 'high', 'alarm_duration': '0'}}}, 'error_code': 0}, {'method': 'getLedStatus', 'result': {'led': {'config': {'enabled': 'on'}}}, 'error_code': 0}, {'method': 'getTargetTrackConfig', 'result': {'target_track': {'target_track_info': {'enabled': 'off', 'people_enabled': 'off', 'pet_enabled': 'off', 'vehicle_enabled': 'off', 'sound_enabled': 'off', 'track_mode': 'pantilt', 'back_time': '30', 'track_time': '0'}}}, 'error_code': 0}, {'method': 'getPresetConfig', 'result': {'preset': {'preset': {'id': [], 'name': [], 'read_only': [], 'position_pan': [], 'position_tilt': [], 'position_zoom': []}}}, 'error_code': 0}, {'method': 'getFirmwareUpdateStatus', 'result': {'cloud_config': {'upgrade_status': {'state': 'normal', 'lastUpgradingSuccess': True}}}, 'error_code': 0}, {'method': 'getMediaEncrypt', 'result': {'cet': {'media_encrypt': {'enabled': 'on'}}}, 'error_code': 0}, {'method': 'getConnectionType', 'result': {'link_type': 'wifi', 'ssid': 'Sligh', 'rssiValue': -46, 'rssi': '4'}, 'error_code': 0}, {'method': 'getAlarmConfig', 'result': {}, 'error_code': -40210}, {'method': 'getAlarmPlan', 'result': {}, 'error_code': -40210}, {'method': 'getSirenTypeList', 'result': {}, 'error_code': -40210}, {'method': 'getLightTypeList', 'result': {}, 'error_code': -40210}, {'method': 'getSirenStatus', 'result': {}, 'error_code': -40210}, {'method': 'getLightFrequencyInfo', 'result': {'image': {'common': {'chroma': '50', 'luma': '50', 'sharpness': '50', 'saturation': '50', 'contrast': '50', 'inf_delay': '5', 'wd_gain': '50', 'exp_gain': '100', 'smartir_level': '0', 'auto_exp_gain_max': '0', 'wb_R_gain': '50', 'wb_B_gain': '50', 'wb_G_gain': '50', 'wtl_sensitivity': '4', 'wtl_delay': '5', 'wtl_sensitivity_day2night': '1400', 'wtl_sensitivity_night2day': '9100', 'iris_level': '160', 'lock_red_gain': '0', 'lock_gr_gain': '0', 'lock_gb_gain': '0', 'lock_blue_gain': '0', 'lock_red_colton': '0', 'lock_green_colton': '0', 'lock_blue_colton': '0', 'focus_limited': '10', 'inf_start_time': '64800', 'inf_end_time': '21600', 'wtl_start_time': '64800', 'wtl_end_time': '21600', 'inf_sensitivity_day2night': '1400', 'inf_sensitivity_night2day': '9100', 'wide_dynamic': 'off', 'high_light_compensation': 'off', 'dehaze': 'off', 'eis': 'off', 'auto_exp_antiflicker': 'off', 'inf_type': 'auto', 'inf_sensitivity': '4', 'wtl_type': 'auto', 'backlight': 'off', 'area_compensation': 'default', 'smartir': 'auto_ir', 'exp_type': 'auto', 'exp_level': '0', 'shutter': '1/25', 'style': 'original', 'focus_type': 'manual', 'wb_type': 'auto', 'lock_source': 'local', 'smartwtl': 'auto_wtl', 'smartwtl_level': '3', 'smartwtl_digital_level': '50', 'light_freq_mode': 'auto'}}}, 'error_code': 0}, {'method': 'getLightFrequencyCapability', 'result': {}, 'error_code': -40210}, {'method': 'getChildDeviceList', 'result': {}, 'error_code': -40210}, {'method': 'getRotationStatus', 'result': {'image': {'switch': {'schedule_end_time': '64800', 'schedule_start_time': '21600', 'clear_licence_plate_mode': 'off', 'switch_mode': 'common', 'rotate_type': 'off', 'flip_type': 'off', 'ldc': 'off', 'night_vision_mode': 'inf_night_vision', 'full_color_people_enhance': 'off', 'full_color_min_keep_time': '30', 'wtl_intensity_level': '5', 'wtl_force_time': '300', 'overexposure_people_suppression': 'off', 'best_view_distance': '0', 'image_scene_mode': 'normal', 'image_scene_mode_common': 'normal', 'image_scene_mode_shedday': 'normal', 'image_scene_mode_shednight': 'normal', 'image_scene_mode_autoday': 'normal', 'image_scene_mode_autonight': 'normal'}}}, 'error_code': 0}, {'method': 'getNightVisionModeConfig', 'result': {'image': {'switch': {'schedule_end_time': '64800', 'schedule_start_time': '21600', 'clear_licence_plate_mode': 'off', 'switch_mode': 'common', 'rotate_type': 'off', 'flip_type': 'off', 'ldc': 'off', 'night_vision_mode': 'inf_night_vision', 'full_color_people_enhance': 'off', 'full_color_min_keep_time': '30', 'wtl_intensity_level': '5', 'wtl_force_time': '300', 'overexposure_people_suppression': 'off', 'best_view_distance': '0', 'image_scene_mode': 'normal', 'image_scene_mode_common': 'normal', 'image_scene_mode_shedday': 'normal', 'image_scene_mode_shednight': 'normal', 'image_scene_mode_autoday': 'normal', 'image_scene_mode_autonight': 'normal'}}}, 'error_code': 0}, {'method': 'getWhitelampStatus', 'result': {'status': 0, 'rest_time': 0}, 'error_code': 0}, {'method': 'getWhitelampConfig', 'result': {'image': {'switch': {'schedule_end_time': '64800', 'schedule_start_time': '21600', 'clear_licence_plate_mode': 'off', 'switch_mode': 'common', 'rotate_type': 'off', 'flip_type': 'off', 'ldc': 'off', 'night_vision_mode': 'inf_night_vision', 'full_color_people_enhance': 'off', 'full_color_min_keep_time': '30', 'wtl_intensity_level': '5', 'wtl_force_time': '300', 'overexposure_people_suppression': 'off', 'best_view_distance': '0', 'image_scene_mode': 'normal', 'image_scene_mode_common': 'normal', 'image_scene_mode_shedday': 'normal', 'image_scene_mode_shednight': 'normal', 'image_scene_mode_autoday': 'normal', 'image_scene_mode_autonight': 'normal'}}}, 'error_code': 0}, {'method': 'getMsgPushConfig', 'result': {'msg_push': {'chn1_msg_push_info': {'notification_enabled': 'on', 'rich_notification_enabled': 'off'}}}, 'error_code': 0}, {'method': 'getSdCardStatus', 'result': {'harddisk_manage': {'hd_info': [{'hd_info_1': {'disk_name': '1', 'rw_attr': 'r', 'status': 'offline', 'detect_status': 'offline', 'write_protect': '0', 'percent': '0', 'type': 'local', 'record_duration': '0', 'record_free_duration': '0', 'record_start_time': '0', 'loop_record_status': '0', 'total_space': '0B', 'total_space_accurate': '0B', 'free_space': '0B', 'free_space_accurate': '0B', 'video_total_space': '0B', 'video_total_space_accurate': '0B', 'video_free_space': '0B', 'video_free_space_accurate': '0B', 'picture_total_space': '0B', 'picture_total_space_accurate': '0B', 'picture_free_space': '0B', 'picture_free_space_accurate': '0B', 'crossline_total_space': '0B', 'crossline_total_space_accurate': '0B', 'crossline_free_space': '0B', 'crossline_free_space_accurate': '0B', 'msg_push_total_space': '0B', 'msg_push_total_space_accurate': '0B', 'msg_push_free_space': '0B', 'msg_push_free_space_accurate': '0B'}}]}}, 'error_code': 0}, {'method': 'getCircularRecordingConfig', 'result': {'harddisk_manage': {'harddisk': {'loop': 'on'}}}, 'error_code': 0}, {'method': 'getRecordPlan', 'result': {'record_plan': {'chn1_channel': {'enabled': 'on', 'monday': '["0000-2400:2"]', 'tuesday': '["0000-2400:2"]', 'wednesday': '["0000-2400:2"]', 'thursday': '["0000-2400:2"]', 'friday': '["0000-2400:2"]', 'saturday': '["0000-2400:2"]', 'sunday': '["0000-2400:2"]'}}}, 'error_code': 0}, {'method': 'getAudioConfig', 'result': {'audio_config': {'speaker': {'volume': '80', 'mute': 'off', 'output_device_type': 'SpeakerOut'}, 'microphone': {'sampling_rate': '8', 'channels': '1', 'encode_type': 'G711alaw', 'mute': 'off', 'volume': '80', 'input_device_type': 'MicIn', 'noise_cancelling': 'on', 'bitrate': '64', 'echo_cancelling': 'off'}}}, 'error_code': 0}, {'method': 'getFirmwareAutoUpgradeConfig', 'result': {'auto_upgrade': {'common': {'enabled': 'on', 'time': '03:00', 'random_range': '120'}}}, 'error_code': 0}]}, 'error_code': 0}

2023-11-18 10:29:26.178 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.178 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'encrypt_type': '3', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.179 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.179 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'encrypt_type': '3', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.180 DEBUG (SyncWorker_0) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.180 DEBUG (SyncWorker_0) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'encrypt_type': '3', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.502 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:26.502 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:26.502 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Connection is secure. 2023-11-18 10:29:26.503 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.503 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'cnonce': 'REDACTED', 'encrypt_type': '3', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.504 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:26.504 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:26.504 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] Connection is secure. 2023-11-18 10:29:26.505 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.505 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'cnonce': 'REDACTED', 'encrypt_type': '3', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.706 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] Status code: 200 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] Processing secure response. 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] Validating device confirm. 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] Signing in with digestPasswd. 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.707 DEBUG (SyncWorker_9) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'cnonce': 'REDACTED', 'encrypt_type': '3', 'digest_passwd': 'REDACTED', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False} 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Status code: 200 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Processing secure response. 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Validating device confirm. 2023-11-18 10:29:26.709 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Signing in with digestPasswd. 2023-11-18 10:29:26.710 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:29:26.710 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'data': {'method': 'login', 'params': {'cnonce': 'REDACTED', 'encrypt_type': '3', 'digest_passwd': 'REDACTED', 'username': 'admin'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False}

2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Status code: 200 2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Processing secure response. 2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Validating device confirm. 2023-11-18 10:29:31.050 DEBUG (SyncWorker_12) [custom_components.tapo_control] [pytapo] Incorrect device_confirm value, raising Exception. 2023-11-18 10:29:31.051 ERROR (MainThread) [custom_components.tapo_control] Unable to connect to Tapo: Cameras Control controller: Invalid authentication data 2023-11-18 10:29:31.052 DEBUG (MainThread) [custom_components.tapo_control] [REAUTH][172.16.0.102] Showing config flow for reauth - stream. 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] {'error_code': -40413, 'result': {'data': {'code': -40401, 'encrypt_type': ['3'], 'key': 'REDACTED', 'nonce': 'REDACTED', 'device_confirm': 'REDACTED'}}} 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Status code: 200 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Processing secure response. 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Validating device confirm. 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Incorrect device_confirm value, retrying: 2/2. 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Refreshing stok... 2023-11-18 10:29:31.055 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] Connection is secure. 2023-11-18 10:29:31.056 DEBUG (SyncWorker_11) [custom_components.tapo_control] [pytapo] New request:

2023-11-18 10:30:13.615 DEBUG (SyncWorker_1) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:30:13.616 DEBUG (SyncWorker_1) [custom_components.tapo_control] [pytapo] {'data': {'method': 'securePassthrough', 'params': {'request': 'XiI05eoFO57rNde3p5R28pylMCZrGByGR79IM4dbdQYZVHcPSt+9kDJJDOl8bR+iwqXJYdG+lz9xkyOHQPzh9dsBQk5b3VUFEKmwEWb0TPFTWVlUs48NxGSBYd9UXCos7BTMqUAwodkE0eiO8uHwZDvmCJhWwKmki8bo/+2qy3xq9k8gta0Yb1s3FZyOC6mE'}}, 'headers': {'Host': 'REDACTED', 'Referer': 'REDACTED', 'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Tapo CameraClient Android', 'Connection': 'close', 'requestByApp': 'true', 'Content-Type': 'application/json; charset=UTF-8', 'Seq': '499', 'Tapo_tag': 'REDACTED'}, 'verify': False} 2023-11-18 10:30:13.614 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for camera Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 440, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.617 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/switch/init.py", line 83, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.618 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for button Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 67, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.619 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 628, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.619 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for number Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 114, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.620 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for select Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 112, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.622 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for siren Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/siren/init.py", line 143, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.623 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for update Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/update/init.py", line 118, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.624 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 169, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.625 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 172.16.0.102 for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 130, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 187, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-11-18 10:30:13.814 DEBUG (SyncWorker_1) [custom_components.tapo_control] [pytapo] 200 2023-11-18 10:30:13.814 DEBUG (SyncWorker_1) [custom_components.tapo_control] [pytapo] {'error_code': 0, 'seq': 499, 'result': {'response': 'jBVRLI77VGO1Kh5qSJ7Ves+yuNkdBgPu5mumc++XJMAokGQtu8Pt8SLi3YPpscSrhybGdfOU2LuClif397XncMc5eupcwxMfcJj5AhugigFrVsFrKYXXqHLUIJh3Nue9F0NhYd1LugPospL+i2zJPkfZ+Ue/UQ/p/D9cWQpzMMJOsBNpNCWSnF8dVulo6Bwue4vdafAn6G5rEWZ/7cQYerSyncYbIkNCWwXn/FdC5aFRZUiEW+QOHPEhQyp//QiHnmuRaE+JBwA8KJS/VZj8i+uYYqwAPn8rYEKfdmjJVNQ='}} 2023-11-18 10:30:19.470 DEBUG (MainThread) [custom_components.tapo_control] _noiseCallback 2023-11-18 10:30:19.470 DEBUG (MainThread) [custom_components.tapo_control] False 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] async_update_data - entry 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] Motion sensor or time sync is enabled. 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] Motion sensor: OK 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] async_update_data - before someEntityEnabled check 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] 2023-11-18 10:30:20.646 DEBUG (MainThread) [custom_components.tapo_control] async_update_data - enabling someEntityEnabled check 2023-11-18 10:30:20.647 DEBUG (MainThread) [custom_components.tapo_control] getCamData 2023-11-18 10:30:20.647 DEBUG (SyncWorker_5) [custom_components.tapo_control] [pytapo] New request: 2023-11-18 10:30:20.648 DEBUG (SyncWorker_5) [custom_components.tapo_control] [pytapo] {'data': {'method': 'securePassthrough', 'params': {'request':

Device Firmware

Firmware: 1.0.24 Build 230731 Rel.42636n Hardware: 1.0

Integration Version

5.4.8

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Intel NUC

Search for similar issues

Yes

Additional information

I'll be glad to troubleshoot or help in anyway - thank you for everything you do!

JurajNyiri commented 7 months ago

Please post the full log as an attachment.

We implemented retry lately, it tries it 3 times now and then assumes wrong password. It looks like camera might lock down some time and we might have to wait longer to retry... Mine did it 18 hours ago randomly even with retry as well.

What I might try next is raise reauth exception only after the auth failed 3 times in row during reload periods (30sec by default in HA), otherwise retry...

Pretty consistently, every time I restart HA,

Does it happen every time or only sometimes on HA restart?

andrewigali commented 7 months ago

Same problem with Model: C200 Hardware version: 1.0 Default device name: Tapo_Camera_A299 Firmware version: 1.3.9 HACS Tapo Cameras Control: 5.4.8

It asks for reconfiguration at random times. Several times a day. After a while, it doesn't even accept the information anymore. Then I have to delete Tapo Cameras Control, restart the camera. There was no such problem in the past.

JurajNyiri commented 7 months ago

@andrewigali what does it mean doesn't accept information? What do you see, what is in the logs? Does it accept if you wait more?

Post debug logs.

As usual further "me too" comments not providing any new information will be deleted.

lokster commented 7 months ago

For me, with 4 different Tapo C200 cameras (two with hw revision 1, two with hw revision 3, all with the latest available firmware), it happens every time I restart HA with at least one of the cameras - no matter which hw revision. Here is my log. I enabled debug logging in the tapo integration, restarted HA, got reauthentication prompt for the camera with IP 192.168.1.121, and then downloaded the logs. For me it always accepts the authentication - no problem with this. home-assistant_tapo_control_2023-11-19T11-46-02.098Z.log

JurajNyiri commented 7 months ago

@lokster you are using multiple versions old integration, please do not report issues unless you are using the latest version otherwise you waste everyones time.

JurajNyiri commented 7 months ago

Should now be fixed in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.4.10 . If not, something is seriously wrong either with camera or password.

In case the issue persists, open new issue.

lokster commented 7 months ago

I didn't notice there were two updates since yesterday. Don't be a dick, I'm trying to help YOU wasting MY time.

JurajNyiri commented 7 months ago

@lokster Banned and reported to GitHub. You were using maximum 5.4.6, which is 4 days old.

kksligh commented 7 months ago

@JurajNyiri thanks for your help! I'll keep monitoring and see what happens.