From fa89b22a64a955bcff908fe9b98bcf0a331e92ae Mon Sep 17 00:00:00 2001 From: Trond Elde Date: Thu, 10 Sep 2026 13:26:59 +0200 Subject: [PATCH] Fix Flexit unit ID range (#181788) --- homeassistant/components/flexit/config_flow.py | 2 +- tests/components/flexit/test_config_flow.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/flexit/config_flow.py b/homeassistant/components/flexit/config_flow.py index 807984c753e8..493cd0252516 100644 --- a/homeassistant/components/flexit/config_flow.py +++ b/homeassistant/components/flexit/config_flow.py @@ -34,7 +34,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) UNIT_SELECTOR = vol.All( - NumberSelector(NumberSelectorConfig(min=1, max=247, mode=NumberSelectorMode.BOX)), + NumberSelector(NumberSelectorConfig(min=1, max=31, mode=NumberSelectorMode.BOX)), vol.Coerce(int), ) diff --git a/tests/components/flexit/test_config_flow.py b/tests/components/flexit/test_config_flow.py index 73b85fbef778..6b4b58ba9030 100644 --- a/tests/components/flexit/test_config_flow.py +++ b/tests/components/flexit/test_config_flow.py @@ -84,7 +84,7 @@ async def test_tcp_host_is_normalized(hass: HomeAssistant) -> None: async def test_maximum_unit(hass: HomeAssistant) -> None: - """Test the maximum Modbus unit ID is accepted.""" + """Test the maximum Flexit unit ID is accepted.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) @@ -93,16 +93,16 @@ async def test_maximum_unit(hass: HomeAssistant) -> None: ) result = await hass.config_entries.flow.async_configure( - result["flow_id"], {**TCP_USER_INPUT, CONF_UNIT: 247} + result["flow_id"], {**TCP_USER_INPUT, CONF_UNIT: 31} ) assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["data"][CONF_UNIT] == 247 + assert result["data"][CONF_UNIT] == 31 -@pytest.mark.parametrize("unit", [0, 248]) +@pytest.mark.parametrize("unit", [0, 32]) async def test_unit_out_of_range(hass: HomeAssistant, unit: int) -> None: - """Test unit IDs outside the Modbus address range are rejected.""" + """Test unit IDs outside the Flexit address range are rejected.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} )