From c49d95b230a73f4d56ec71fc7de538b80c2e8e23 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Wed, 11 Jun 2025 12:31:07 +0200 Subject: [PATCH] Remove Z-Wave useless reconfigure options (#146520) * Remove emulate hardware option * Remove log level option --- .../components/zwave_js/config_flow.py | 24 -------- homeassistant/components/zwave_js/const.py | 2 - .../components/zwave_js/strings.json | 2 - tests/components/zwave_js/test_config_flow.py | 58 +------------------ 4 files changed, 1 insertion(+), 85 deletions(-) diff --git a/homeassistant/components/zwave_js/config_flow.py b/homeassistant/components/zwave_js/config_flow.py index 08c9ec2e2b2..5e8e7022839 100644 --- a/homeassistant/components/zwave_js/config_flow.py +++ b/homeassistant/components/zwave_js/config_flow.py @@ -46,8 +46,6 @@ from .addon import get_addon_manager from .const import ( ADDON_SLUG, CONF_ADDON_DEVICE, - CONF_ADDON_EMULATE_HARDWARE, - CONF_ADDON_LOG_LEVEL, CONF_ADDON_LR_S2_ACCESS_CONTROL_KEY, CONF_ADDON_LR_S2_AUTHENTICATED_KEY, CONF_ADDON_NETWORK_KEY, @@ -78,17 +76,7 @@ TITLE = "Z-Wave JS" ADDON_SETUP_TIMEOUT = 5 ADDON_SETUP_TIMEOUT_ROUNDS = 40 -CONF_EMULATE_HARDWARE = "emulate_hardware" -CONF_LOG_LEVEL = "log_level" -ADDON_LOG_LEVELS = { - "error": "Error", - "warn": "Warn", - "info": "Info", - "verbose": "Verbose", - "debug": "Debug", - "silly": "Silly", -} ADDON_USER_INPUT_MAP = { CONF_ADDON_DEVICE: CONF_USB_PATH, CONF_ADDON_S0_LEGACY_KEY: CONF_S0_LEGACY_KEY, @@ -97,8 +85,6 @@ ADDON_USER_INPUT_MAP = { CONF_ADDON_S2_UNAUTHENTICATED_KEY: CONF_S2_UNAUTHENTICATED_KEY, CONF_ADDON_LR_S2_ACCESS_CONTROL_KEY: CONF_LR_S2_ACCESS_CONTROL_KEY, CONF_ADDON_LR_S2_AUTHENTICATED_KEY: CONF_LR_S2_AUTHENTICATED_KEY, - CONF_ADDON_LOG_LEVEL: CONF_LOG_LEVEL, - CONF_ADDON_EMULATE_HARDWARE: CONF_EMULATE_HARDWARE, } ON_SUPERVISOR_SCHEMA = vol.Schema({vol.Optional(CONF_USE_ADDON, default=True): bool}) @@ -1097,10 +1083,6 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN): CONF_ADDON_S2_UNAUTHENTICATED_KEY: self.s2_unauthenticated_key, CONF_ADDON_LR_S2_ACCESS_CONTROL_KEY: self.lr_s2_access_control_key, CONF_ADDON_LR_S2_AUTHENTICATED_KEY: self.lr_s2_authenticated_key, - CONF_ADDON_LOG_LEVEL: user_input[CONF_LOG_LEVEL], - CONF_ADDON_EMULATE_HARDWARE: user_input.get( - CONF_EMULATE_HARDWARE, False - ), } await self._async_set_addon_config(addon_config_updates) @@ -1135,8 +1117,6 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN): lr_s2_authenticated_key = addon_config.get( CONF_ADDON_LR_S2_AUTHENTICATED_KEY, self.lr_s2_authenticated_key or "" ) - log_level = addon_config.get(CONF_ADDON_LOG_LEVEL, "info") - emulate_hardware = addon_config.get(CONF_ADDON_EMULATE_HARDWARE, False) try: ports = await async_get_usb_ports(self.hass) @@ -1163,10 +1143,6 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN): vol.Optional( CONF_LR_S2_AUTHENTICATED_KEY, default=lr_s2_authenticated_key ): str, - vol.Optional(CONF_LOG_LEVEL, default=log_level): vol.In( - ADDON_LOG_LEVELS - ), - vol.Optional(CONF_EMULATE_HARDWARE, default=emulate_hardware): bool, } ) diff --git a/homeassistant/components/zwave_js/const.py b/homeassistant/components/zwave_js/const.py index 6d5cbb98902..3d626710d52 100644 --- a/homeassistant/components/zwave_js/const.py +++ b/homeassistant/components/zwave_js/const.py @@ -16,8 +16,6 @@ LR_ADDON_VERSION = AwesomeVersion("0.5.0") USER_AGENT = {APPLICATION_NAME: HA_VERSION} CONF_ADDON_DEVICE = "device" -CONF_ADDON_EMULATE_HARDWARE = "emulate_hardware" -CONF_ADDON_LOG_LEVEL = "log_level" CONF_ADDON_NETWORK_KEY = "network_key" CONF_ADDON_S0_LEGACY_KEY = "s0_legacy_key" CONF_ADDON_S2_ACCESS_CONTROL_KEY = "s2_access_control_key" diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index 6b7d9cf492e..bceed10274b 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -52,8 +52,6 @@ }, "configure_addon_reconfigure": { "data": { - "emulate_hardware": "Emulate Hardware", - "log_level": "Log level", "lr_s2_access_control_key": "[%key:component::zwave_js::config::step::configure_addon_user::data::lr_s2_access_control_key%]", "lr_s2_authenticated_key": "[%key:component::zwave_js::config::step::configure_addon_user::data::lr_s2_authenticated_key%]", "s0_legacy_key": "[%key:component::zwave_js::config::step::configure_addon_user::data::s0_legacy_key%]", diff --git a/tests/components/zwave_js/test_config_flow.py b/tests/components/zwave_js/test_config_flow.py index fc01c9b29b1..dd8838e0775 100644 --- a/tests/components/zwave_js/test_config_flow.py +++ b/tests/components/zwave_js/test_config_flow.py @@ -2566,8 +2566,6 @@ async def test_reconfigure_not_addon_with_addon_stop_fail( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 0, ), @@ -2591,8 +2589,6 @@ async def test_reconfigure_not_addon_with_addon_stop_fail( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 1, ), @@ -2706,8 +2702,6 @@ async def test_reconfigure_addon_running( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, }, { "usb_path": "/test", @@ -2717,8 +2711,6 @@ async def test_reconfigure_addon_running( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, }, ), ], @@ -2836,8 +2828,6 @@ async def different_device_server_version(*args): "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, }, { "usb_path": "/new", @@ -2847,35 +2837,6 @@ async def different_device_server_version(*args): "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, - }, - 0, - different_device_server_version, - ), - ( - {}, - { - "device": "/test", - "network_key": "old123", - "s0_legacy_key": "old123", - "s2_access_control_key": "old456", - "s2_authenticated_key": "old789", - "s2_unauthenticated_key": "old987", - "lr_s2_access_control_key": "old654", - "lr_s2_authenticated_key": "old321", - "log_level": "info", - }, - { - "usb_path": "/new", - "s0_legacy_key": "new123", - "s2_access_control_key": "new456", - "s2_authenticated_key": "new789", - "s2_unauthenticated_key": "new987", - "lr_s2_access_control_key": "new654", - "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 0, different_device_server_version, @@ -2946,8 +2907,7 @@ async def test_reconfigure_different_device( result = await hass.config_entries.flow.async_configure(result["flow_id"]) await hass.async_block_till_done() - # Default emulate_hardware is False. - addon_options = {"emulate_hardware": False} | old_addon_options + addon_options = {} | old_addon_options # Legacy network key is not reset. addon_options.pop("network_key") @@ -2994,8 +2954,6 @@ async def test_reconfigure_different_device( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, }, { "usb_path": "/new", @@ -3005,8 +2963,6 @@ async def test_reconfigure_different_device( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 0, [SupervisorError(), None], @@ -3022,8 +2978,6 @@ async def test_reconfigure_different_device( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, }, { "usb_path": "/new", @@ -3033,8 +2987,6 @@ async def test_reconfigure_different_device( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 0, [ @@ -3151,8 +3103,6 @@ async def test_reconfigure_addon_running_server_info_failure( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, } new_addon_options = { "usb_path": "/test", @@ -3162,8 +3112,6 @@ async def test_reconfigure_addon_running_server_info_failure( "s2_unauthenticated_key": "old987", "lr_s2_access_control_key": "old654", "lr_s2_authenticated_key": "old321", - "log_level": "info", - "emulate_hardware": False, } addon_options.update(old_addon_options) entry = integration @@ -3236,8 +3184,6 @@ async def test_reconfigure_addon_running_server_info_failure( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 0, ), @@ -3261,8 +3207,6 @@ async def test_reconfigure_addon_running_server_info_failure( "s2_unauthenticated_key": "new987", "lr_s2_access_control_key": "new654", "lr_s2_authenticated_key": "new321", - "log_level": "info", - "emulate_hardware": False, }, 1, ),