From 3834c45f48f94ecd70de2ba908ffd8fa09543e62 Mon Sep 17 00:00:00 2001 From: alainmic <56118503+alainmic@users.noreply.github.com> Date: Mon, 5 Oct 2026 05:12:49 -0400 Subject: [PATCH] Add Tuya select platform support for category hwsb (#183618) --- homeassistant/components/tuya/icons.json | 3 ++ homeassistant/components/tuya/select.py | 6 ++++ homeassistant/components/tuya/strings.json | 3 ++ tests/components/tuya/test_select.py | 37 ++++++++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/homeassistant/components/tuya/icons.json b/homeassistant/components/tuya/icons.json index 8aa819ea980a..aa28a88706d5 100644 --- a/homeassistant/components/tuya/icons.json +++ b/homeassistant/components/tuya/icons.json @@ -136,6 +136,9 @@ "motion_sensitivity": { "default": "mdi:motion-sensor" }, + "pump_mode": { + "default": "mdi:pump" + }, "record_mode": { "default": "mdi:record-rec" }, diff --git a/homeassistant/components/tuya/select.py b/homeassistant/components/tuya/select.py index 7e817bf44684..8f36e17fac74 100644 --- a/homeassistant/components/tuya/select.py +++ b/homeassistant/components/tuya/select.py @@ -126,6 +126,12 @@ SELECTS: dict[DeviceCategory, tuple[TuyaSelectEntityDescription, ...]] = { translation_key="countdown", ), ), + DeviceCategory.HWSB: ( + TuyaSelectEntityDescription( + key=DPCode.MODE, + translation_key="pump_mode", + ), + ), DeviceCategory.JSQ: ( TuyaSelectEntityDescription( key=DPCode.SPRAY_MODE, diff --git a/homeassistant/components/tuya/strings.json b/homeassistant/components/tuya/strings.json index 5dc61aa1c3d2..961e817bbeaf 100644 --- a/homeassistant/components/tuya/strings.json +++ b/homeassistant/components/tuya/strings.json @@ -544,6 +544,9 @@ "smart": "Smart" } }, + "pump_mode": { + "name": "Mode" + }, "quick_heat_temperature": { "name": "Quick heat temperature", "state": { diff --git a/tests/components/tuya/test_select.py b/tests/components/tuya/test_select.py index efa6a1dc313b..7e8063a34abf 100644 --- a/tests/components/tuya/test_select.py +++ b/tests/components/tuya/test_select.py @@ -150,3 +150,40 @@ async def test_select_invalid_option( blocking=True, ) assert exc.value.translation_key == "not_valid_option" + + +@pytest.mark.parametrize("mock_device_code", ["hwsb_ircs2n82vgrozoew"]) +async def test_hwsb_select_with_quirk( + hass: HomeAssistant, + mock_manager: Manager, + mock_config_entry: MockConfigEntry, + mock_device: CustomerDevice, + entity_registry: er.EntityRegistry, +) -> None: + """Test HWSB outdoor equipment select with quirk applied.""" + mock_device.status["mode"] = "MI" + await initialize_entry(hass, mock_manager, mock_config_entry, mock_device) + + entity_id = "select.inverflow_mode" + state = hass.states.get(entity_id) + assert state is not None + assert state.state == "MI" + assert state.attributes["options"] == ["MI", "AI", "backwash"] + + entry = entity_registry.async_get(entity_id) + assert entry is not None + assert entry.translation_key == "pump_mode" + assert entry.entity_category is None + + await hass.services.async_call( + SELECT_DOMAIN, + SERVICE_SELECT_OPTION, + { + ATTR_ENTITY_ID: entity_id, + ATTR_OPTION: "AI", + }, + blocking=True, + ) + mock_manager.send_commands.assert_called_once_with( + mock_device.id, [{"code": "mode", "value": "AI"}] + )