From d827c53a855075f8dbef51e2e147992f6d8452ef Mon Sep 17 00:00:00 2001 From: mvn23 Date: Tue, 3 Sep 2024 15:59:12 +0200 Subject: [PATCH] Remove opentherm_gw options migration (#125046) --- .../components/opentherm_gw/__init__.py | 13 ----- .../opentherm_gw/test_config_flow.py | 53 ------------------- 2 files changed, 66 deletions(-) diff --git a/homeassistant/components/opentherm_gw/__init__.py b/homeassistant/components/opentherm_gw/__init__.py index d8c352f3768..a57ae7db601 100644 --- a/homeassistant/components/opentherm_gw/__init__.py +++ b/homeassistant/components/opentherm_gw/__init__.py @@ -46,8 +46,6 @@ from .const import ( CONF_CLIMATE, CONF_FLOOR_TEMP, CONF_PRECISION, - CONF_READ_PRECISION, - CONF_SET_PRECISION, CONNECTION_TIMEOUT, DATA_GATEWAYS, DATA_OPENTHERM_GW, @@ -109,17 +107,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b gateway = OpenThermGatewayHub(hass, config_entry) hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]] = gateway - if config_entry.options.get(CONF_PRECISION): - migrate_options = dict(config_entry.options) - migrate_options.update( - { - CONF_READ_PRECISION: config_entry.options[CONF_PRECISION], - CONF_SET_PRECISION: config_entry.options[CONF_PRECISION], - } - ) - del migrate_options[CONF_PRECISION] - hass.config_entries.async_update_entry(config_entry, options=migrate_options) - # Migration can be removed in 2025.4.0 dev_reg = dr.async_get(hass) if ( diff --git a/tests/components/opentherm_gw/test_config_flow.py b/tests/components/opentherm_gw/test_config_flow.py index e61a87bb55e..504a97dc953 100644 --- a/tests/components/opentherm_gw/test_config_flow.py +++ b/tests/components/opentherm_gw/test_config_flow.py @@ -8,7 +8,6 @@ from serial import SerialException from homeassistant import config_entries from homeassistant.components.opentherm_gw.const import ( CONF_FLOOR_TEMP, - CONF_PRECISION, CONF_READ_PRECISION, CONF_SET_PRECISION, CONF_TEMPORARY_OVRD_MODE, @@ -204,58 +203,6 @@ async def test_form_connection_error(hass: HomeAssistant) -> None: assert len(mock_connect.mock_calls) == 1 -async def test_options_migration(hass: HomeAssistant) -> None: - """Test migration of precision option after update.""" - entry = MockConfigEntry( - domain=DOMAIN, - title="Mock Gateway", - data={ - CONF_NAME: "Test Entry 1", - CONF_DEVICE: "/dev/ttyUSB0", - CONF_ID: "test_entry_1", - }, - options={ - CONF_FLOOR_TEMP: True, - CONF_PRECISION: PRECISION_TENTHS, - }, - ) - entry.add_to_hass(hass) - - with ( - patch( - "homeassistant.components.opentherm_gw.OpenThermGatewayHub.connect_and_subscribe", - return_value=True, - ), - patch( - "homeassistant.components.opentherm_gw.async_setup", - return_value=True, - ), - patch( - "pyotgw.status.StatusManager._process_updates", - return_value=None, - ), - ): - await hass.config_entries.async_setup(entry.entry_id) - await hass.async_block_till_done() - - result = await hass.config_entries.options.async_init( - entry.entry_id, context={"source": config_entries.SOURCE_USER}, data=None - ) - - assert result["type"] is FlowResultType.FORM - assert result["step_id"] == "init" - - result = await hass.config_entries.options.async_configure( - result["flow_id"], - user_input={}, - ) - - assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["data"][CONF_READ_PRECISION] == PRECISION_TENTHS - assert result["data"][CONF_SET_PRECISION] == PRECISION_TENTHS - assert result["data"][CONF_FLOOR_TEMP] is True - - async def test_options_form(hass: HomeAssistant) -> None: """Test the options form.""" entry = MockConfigEntry(