diff --git a/custom_components/ezviz_cloud/config_flow.py b/custom_components/ezviz_cloud/config_flow.py index 2a710cb..6b2539e 100644 --- a/custom_components/ezviz_cloud/config_flow.py +++ b/custom_components/ezviz_cloud/config_flow.py @@ -42,6 +42,7 @@ CONF_FFMPEG_ARGUMENTS, CONF_RF_SESSION_ID, CONF_SESSION_ID, + CONF_TEST_RTSP_CREDENTIALS, DEFAULT_CAMERA_USERNAME, DEFAULT_FFMPEG_ARGUMENTS, DEFAULT_TIMEOUT, @@ -151,12 +152,13 @@ async def _validate_and_create_camera_rtsp(self, data: dict) -> ConfigFlowResult _get_cam_enc_key, data, ezviz_client ) + # If newer camera, the encryption key is the password. if data[CONF_PASSWORD] == "fetch_my_key": data[CONF_PASSWORD] = data[CONF_ENC_KEY] - # Test camera RTSP credentials. Older cameras still use the verification code on the camra and not the encryption key. - - await self.hass.async_add_executor_job(_wake_camera, data, ezviz_client) + # Test camera RTSP credentials. Older cameras still use the verification code on the camera and not the encryption key. + if data[CONF_TEST_RTSP_CREDENTIALS]: + await self.hass.async_add_executor_job(_wake_camera, data, ezviz_client) return self.async_create_entry( title=data[ATTR_SERIAL], @@ -342,6 +344,7 @@ async def async_step_confirm( { vol.Required(CONF_USERNAME, default=DEFAULT_CAMERA_USERNAME): str, vol.Required(CONF_PASSWORD, default="fetch_my_key"): str, + vol.Optional(CONF_TEST_RTSP_CREDENTIALS, default=True): bool, } ) diff --git a/custom_components/ezviz_cloud/const.py b/custom_components/ezviz_cloud/const.py index ea6cabe..226f774 100644 --- a/custom_components/ezviz_cloud/const.py +++ b/custom_components/ezviz_cloud/const.py @@ -12,6 +12,7 @@ CONF_RF_SESSION_ID = "rf_session_id" CONF_EZVIZ_ACCOUNT = "ezviz_account" CONF_ENC_KEY = "enc_key" +CONF_TEST_RTSP_CREDENTIALS = "test_rtsp_credentials" # Service names SERVICE_WAKE_DEVICE = "wake_device" diff --git a/custom_components/ezviz_cloud/strings.json b/custom_components/ezviz_cloud/strings.json index 9898f80..6d39fa9 100644 --- a/custom_components/ezviz_cloud/strings.json +++ b/custom_components/ezviz_cloud/strings.json @@ -24,7 +24,8 @@ "description": "Enter RTSP credentials for EZVIZ camera {serial} with IP {ip_address}", "data": { "username": "[%key:common::config_flow::data::username%]", - "password": "[%key:common::config_flow::data::password%]" + "password": "[%key:common::config_flow::data::password%]", + "test_rtsp_credentials": "Test RTSP credentials" } }, "reauth_confirm": { diff --git a/custom_components/ezviz_cloud/translations/en.json b/custom_components/ezviz_cloud/translations/en.json index 5e00574..ffb9962 100644 --- a/custom_components/ezviz_cloud/translations/en.json +++ b/custom_components/ezviz_cloud/translations/en.json @@ -1,206 +1,207 @@ { - "config": { - "abort": { - "already_configured_account": "Account is already configured", - "ezviz_cloud_account_missing": "Ezviz cloud account missing. Please reconfigure Ezviz cloud account", - "reauth_successful": "Re-authentication was successful", - "unknown": "Unexpected error" - }, - "error": { - "cannot_connect": "Failed to connect", - "invalid_auth": "Invalid authentication", - "invalid_host": "Invalid hostname or IP address", - "mfa_required": "2FA enabled on account, please disable and retry" - }, - "flow_title": "{serial}", - "step": { - "confirm": { - "data": { - "password": "Password", - "username": "Username" - }, - "description": "Enter RTSP credentials for EZVIZ camera {serial} with IP {ip_address}", - "title": "Discovered EZVIZ Camera" - }, - "reauth_confirm": { - "data": { - "password": "Password", - "username": "Username" - }, - "description": "Enter credentials to reauthenticate to ezviz cloud account", - "title": "Authentication expired for {name}" - }, - "reauth_mfa": { - "data": { - "sms_code": "MFA Code" - }, - "description": "Enter MFA code to authenticate ezviz cloud account", - "title": "EZVIZ Cloud MFA Authentication" - }, - "user": { - "data": { - "password": "Password", - "url": "URL", - "username": "Username" - }, - "title": "Connect to EZVIZ Cloud" - }, - "user_custom_url": { - "data": { - "password": "Password", - "url": "URL", - "username": "Username" - }, - "description": "Manually specify your region URL", - "title": "Connect to custom EZVIZ URL" - }, - "user_mfa_confirm": { - "data": { - "sms_code": "MFA Code" - }, - "description": "Enter MFA code to authenticate ezviz cloud account", - "title": "EZVIZ Cloud MFA Authentication" - } - } + "config": { + "abort": { + "already_configured_account": "Account is already configured", + "ezviz_cloud_account_missing": "Ezviz cloud account missing. Please reconfigure Ezviz cloud account", + "reauth_successful": "Re-authentication was successful", + "unknown": "Unexpected error" }, - "entity": { - "binary_sensor": { - "alarm_schedules_enabled": { - "name": "Alarm schedules enabled" - }, - "encrypted": { - "name": "Encryption" - } - }, - "button": { - "ptz_down": { - "name": "PTZ down" - }, - "ptz_left": { - "name": "PTZ left" - }, - "ptz_right": { - "name": "PTZ right" - }, - "ptz_up": { - "name": "PTZ up" - } - }, - "image": { - "last_motion_image": { - "name": "Last motion image" - } + "error": { + "cannot_connect": "Failed to connect", + "invalid_auth": "Invalid authentication", + "invalid_host": "Invalid hostname or IP address", + "mfa_required": "2FA enabled on account, please disable and retry" + }, + "flow_title": "{serial}", + "step": { + "confirm": { + "data": { + "password": "Password", + "username": "Username", + "test_rtsp_credentials": "Test RTSP credentials" }, - "light": { - "light": { - "name": "Light" - } + "description": "Enter RTSP credentials for EZVIZ camera {serial} with IP {ip_address}", + "title": "Discovered EZVIZ Camera" + }, + "reauth_confirm": { + "data": { + "password": "Password", + "username": "Username" }, - "number": { - "detection_sensibility": { - "name": "Detection sensitivity" - } + "description": "Enter credentials to reauthenticate to ezviz cloud account", + "title": "Authentication expired for {name}" + }, + "reauth_mfa": { + "data": { + "sms_code": "MFA Code" }, - "select": { - "alarm_sound_mode": { - "name": "Warning sound", - "state": { - "intensive": "Intensive", - "silent": "Silent", - "soft": "Soft" - } - } + "description": "Enter MFA code to authenticate ezviz cloud account", + "title": "EZVIZ Cloud MFA Authentication" + }, + "user": { + "data": { + "password": "Password", + "url": "URL", + "username": "Username" }, - "sensor": { - "alarm_sound_mod": { - "name": "Alarm sound level" - }, - "last_alarm_pic": { - "name": "Last alarm picture URL" - }, - "last_alarm_time": { - "name": "Last alarm time" - }, - "last_alarm_type_code": { - "name": "Last alarm type code" - }, - "last_alarm_type_name": { - "name": "Last alarm type name" - }, - "local_ip": { - "name": "Local IP" - }, - "pir_status": { - "name": "PIR status" - }, - "seconds_last_trigger": { - "name": "Seconds since last trigger" - }, - "supported_channels": { - "name": "Supported channels" - }, - "wan_ip": { - "name": "WAN IP" - } + "title": "Connect to EZVIZ Cloud" + }, + "user_custom_url": { + "data": { + "password": "Password", + "url": "URL", + "username": "Username" }, - "siren": { - "siren": { - "name": "Siren" - } + "description": "Manually specify your region URL", + "title": "Connect to custom EZVIZ URL" + }, + "user_mfa_confirm": { + "data": { + "sms_code": "MFA Code" }, - "switch": { - "all_day_video_recording": { - "name": "All day video recording" - }, - "audio": { - "name": "Audio" - }, - "auto_sleep": { - "name": "Auto sleep" - }, - "flicker_light_on_movement": { - "name": "Flicker light on movement" - }, - "follow_movement": { - "name": "Follow movement" - }, - "infrared_light": { - "name": "Infrared light" - }, - "motion_tracking": { - "name": "Motion tracking" - }, - "pir_motion_activated_light": { - "name": "PIR motion activated light" - }, - "privacy": { - "name": "Privacy" - }, - "sleep": { - "name": "Sleep" - }, - "status_light": { - "name": "Status light" - }, - "tamper_alarm": { - "name": "Tamper alarm" - } - } + "description": "Enter MFA code to authenticate ezviz cloud account", + "title": "EZVIZ Cloud MFA Authentication" + } + } + }, + "entity": { + "binary_sensor": { + "alarm_schedules_enabled": { + "name": "Alarm schedules enabled" + }, + "encrypted": { + "name": "Encryption" + } }, - "options": { - "step": { - "init": { - "data": { - "ffmpeg_arguments": "Arguments passed to ffmpeg for cameras", - "timeout": "Request Timeout (seconds)" - } - } + "button": { + "ptz_down": { + "name": "PTZ down" + }, + "ptz_left": { + "name": "PTZ left" + }, + "ptz_right": { + "name": "PTZ right" + }, + "ptz_up": { + "name": "PTZ up" + } + }, + "image": { + "last_motion_image": { + "name": "Last motion image" + } + }, + "light": { + "light": { + "name": "Light" + } + }, + "number": { + "detection_sensibility": { + "name": "Detection sensitivity" + } + }, + "select": { + "alarm_sound_mode": { + "name": "Warning sound", + "state": { + "intensive": "Intensive", + "silent": "Silent", + "soft": "Soft" } + } }, - "services": { - "wake_device": { - "description": "This can be used to wake the camera/device from hibernation.", - "name": "Wake camera" + "sensor": { + "alarm_sound_mod": { + "name": "Alarm sound level" + }, + "last_alarm_pic": { + "name": "Last alarm picture URL" + }, + "last_alarm_time": { + "name": "Last alarm time" + }, + "last_alarm_type_code": { + "name": "Last alarm type code" + }, + "last_alarm_type_name": { + "name": "Last alarm type name" + }, + "local_ip": { + "name": "Local IP" + }, + "pir_status": { + "name": "PIR status" + }, + "seconds_last_trigger": { + "name": "Seconds since last trigger" + }, + "supported_channels": { + "name": "Supported channels" + }, + "wan_ip": { + "name": "WAN IP" + } + }, + "siren": { + "siren": { + "name": "Siren" + } + }, + "switch": { + "all_day_video_recording": { + "name": "All day video recording" + }, + "audio": { + "name": "Audio" + }, + "auto_sleep": { + "name": "Auto sleep" + }, + "flicker_light_on_movement": { + "name": "Flicker light on movement" + }, + "follow_movement": { + "name": "Follow movement" + }, + "infrared_light": { + "name": "Infrared light" + }, + "motion_tracking": { + "name": "Motion tracking" + }, + "pir_motion_activated_light": { + "name": "PIR motion activated light" + }, + "privacy": { + "name": "Privacy" + }, + "sleep": { + "name": "Sleep" + }, + "status_light": { + "name": "Status light" + }, + "tamper_alarm": { + "name": "Tamper alarm" + } + } + }, + "options": { + "step": { + "init": { + "data": { + "ffmpeg_arguments": "Arguments passed to ffmpeg for cameras", + "timeout": "Request Timeout (seconds)" } + } + } + }, + "services": { + "wake_device": { + "description": "This can be used to wake the camera/device from hibernation.", + "name": "Wake camera" } -} \ No newline at end of file + } +}