From b6c06d2f9f448efc1b8317f83765b6d1dd9ba6a2 Mon Sep 17 00:00:00 2001 From: Elliott Balsley <3991046+llamafilm@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:51:37 -0700 Subject: [PATCH] fix: key error for CONF_API_PROXY_CERT (#890) closes #889 --- custom_components/tesla_custom/__init__.py | 2 +- custom_components/tesla_custom/config_flow.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/tesla_custom/__init__.py b/custom_components/tesla_custom/__init__.py index 17875f61..73f0e796 100644 --- a/custom_components/tesla_custom/__init__.py +++ b/custom_components/tesla_custom/__init__.py @@ -141,7 +141,7 @@ async def async_setup_entry(hass, config_entry): # Because users can have multiple accounts, we always # create a new session so they have separate cookies - if config[CONF_API_PROXY_CERT]: + if config.get(CONF_API_PROXY_CERT): try: SSL_CONTEXT.load_verify_locations(config[CONF_API_PROXY_CERT]) _LOGGER.debug(SSL_CONTEXT) diff --git a/custom_components/tesla_custom/config_flow.py b/custom_components/tesla_custom/config_flow.py index 6d1427f6..aa7cf54b 100644 --- a/custom_components/tesla_custom/config_flow.py +++ b/custom_components/tesla_custom/config_flow.py @@ -80,7 +80,7 @@ async def async_step_user(self, user_input=None): if CONF_API_PROXY_CERT in user_input: return await self.async_step_credentials(user_input) - self.use_proxy = user_input[CONF_API_PROXY_ENABLE] + self.use_proxy = user_input.get(CONF_API_PROXY_ENABLE, False) return await self.async_step_credentials() async def async_step_credentials(self, user_input=None):