mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 14:58:11 -04:00
Add Tuya select platform support for category hwsb (#183618)
This commit is contained in:
@@ -136,6 +136,9 @@
|
||||
"motion_sensitivity": {
|
||||
"default": "mdi:motion-sensor"
|
||||
},
|
||||
"pump_mode": {
|
||||
"default": "mdi:pump"
|
||||
},
|
||||
"record_mode": {
|
||||
"default": "mdi:record-rec"
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -544,6 +544,9 @@
|
||||
"smart": "Smart"
|
||||
}
|
||||
},
|
||||
"pump_mode": {
|
||||
"name": "Mode"
|
||||
},
|
||||
"quick_heat_temperature": {
|
||||
"name": "Quick heat temperature",
|
||||
"state": {
|
||||
|
||||
@@ -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"}]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user