From 1f18398543d547456118478921981509b2bd65ec Mon Sep 17 00:00:00 2001 From: cyr-ius Date: Wed, 8 May 2024 09:46:55 +0200 Subject: [PATCH] Add verify tls option --- custom_components/livebox/config_flow.py | 11 +++++------ custom_components/livebox/const.py | 1 + custom_components/livebox/strings.json | 3 ++- custom_components/livebox/translations/en.json | 3 ++- custom_components/livebox/translations/fr.json | 3 ++- custom_components/livebox/translations/nb.json | 1 + 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/custom_components/livebox/config_flow.py b/custom_components/livebox/config_flow.py index 736fb3a..daf24eb 100644 --- a/custom_components/livebox/config_flow.py +++ b/custom_components/livebox/config_flow.py @@ -1,4 +1,5 @@ """Config flow to configure Livebox.""" + from __future__ import annotations from collections.abc import Mapping @@ -18,12 +19,7 @@ from homeassistant import config_entries from homeassistant.components import ssdp from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ( - CONF_HOST, - CONF_PASSWORD, - CONF_PORT, - CONF_USERNAME, -) +from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers import config_validation as cv @@ -33,6 +29,7 @@ CONF_LAN_TRACKING, CONF_TRACKING_TIMEOUT, CONF_USE_TLS, + CONF_VERIFY_TLS, DEFAULT_HOST, DEFAULT_LAN_TRACKING, DEFAULT_PORT, @@ -48,6 +45,7 @@ vol.Required(CONF_PASSWORD): str, vol.Required(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Required(CONF_USE_TLS, default=False): bool, + vol.Required(CONF_VERIFY_TLS, default=True): bool, } ) @@ -83,6 +81,7 @@ async def async_step_user( host=user_input[CONF_HOST], port=user_input[CONF_PORT], use_tls=user_input[CONF_USE_TLS], + verify_tls=user_input[CONF_VERIFY_TLS], ) await api.async_connect() await api.async_get_permissions() diff --git a/custom_components/livebox/const.py b/custom_components/livebox/const.py index 7e69d13..5dae94b 100644 --- a/custom_components/livebox/const.py +++ b/custom_components/livebox/const.py @@ -13,6 +13,7 @@ CALLID = "callId" CONF_USE_TLS = "use_tls" +CONF_VERIFY_TLS = "verify_tls" CONF_LAN_TRACKING = "lan_tracking" DEFAULT_LAN_TRACKING = False diff --git a/custom_components/livebox/strings.json b/custom_components/livebox/strings.json index 577d98a..132022d 100644 --- a/custom_components/livebox/strings.json +++ b/custom_components/livebox/strings.json @@ -8,7 +8,8 @@ "username": "[%key:common::config_flow::data::username%]", "password": "[%key:common::config_flow::data::password%]", "port": "[%key:common::config_flow::data::port%]", - "use_tls": "Use TLS" + "use_tls": "Use TLS", + "verify_tls": "Verify TLS" } } }, diff --git a/custom_components/livebox/translations/en.json b/custom_components/livebox/translations/en.json index 398587a..76e0b7c 100644 --- a/custom_components/livebox/translations/en.json +++ b/custom_components/livebox/translations/en.json @@ -8,7 +8,8 @@ "username": "Username", "password": "Password", "port": "Port", - "use_tls": "Use SSL" + "use_tls": "Use TSL", + "verify_tls": "Verify TLS" } } }, diff --git a/custom_components/livebox/translations/fr.json b/custom_components/livebox/translations/fr.json index b571ec8..4e39a5d 100644 --- a/custom_components/livebox/translations/fr.json +++ b/custom_components/livebox/translations/fr.json @@ -8,7 +8,8 @@ "username": "Utilisateur", "password": "Mot de passe", "port": "Port", - "use_tls": "Utiliser SSL/TLS" + "use_tls": "Utiliser SSL/TLS", + "verify_tls": "Verify SSL/TLS" } } }, diff --git a/custom_components/livebox/translations/nb.json b/custom_components/livebox/translations/nb.json index 7daf6ef..235527f 100644 --- a/custom_components/livebox/translations/nb.json +++ b/custom_components/livebox/translations/nb.json @@ -8,6 +8,7 @@ "username": "Brukernavn", "password": "Passord", "port": "Port", + "use_tls": "Use TSL", "verify_ssl": "SSL/TLS" } }