mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add setting to change carpet clean mode (#1458)
Some checks failed
CI / Perform linting checks (3.13) (push) Has been cancelled
CodeQL checks / Analyze (python) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Has been cancelled
Some checks failed
CI / Perform linting checks (3.13) (push) Has been cancelled
CodeQL checks / Analyze (python) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Has been cancelled
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Has been cancelled
Add new setting to control carpet clean mode: ``` == Configuration == Carpet clean mode (carpet_clean_mode): Normal *Boost* ```
This commit is contained in:
@@ -21,6 +21,7 @@ clean = parametrize("clean module", component_filter="clean", protocol_filter={"
|
||||
("vacuum_status", "status", Status),
|
||||
("vacuum_error", "error", ErrorCode),
|
||||
("vacuum_fan_speed", "fan_speed_preset", str),
|
||||
("carpet_clean_mode", "carpet_clean_mode", str),
|
||||
("battery_level", "battery", int),
|
||||
],
|
||||
)
|
||||
@@ -69,6 +70,13 @@ async def test_features(dev: SmartDevice, feature: str, prop_name: str, type: ty
|
||||
{"suction": 1, "type": "global"},
|
||||
id="vacuum_fan_speed",
|
||||
),
|
||||
pytest.param(
|
||||
"carpet_clean_mode",
|
||||
"Boost",
|
||||
"setCarpetClean",
|
||||
{"carpet_clean_prefer": "boost"},
|
||||
id="carpet_clean_mode",
|
||||
),
|
||||
pytest.param(
|
||||
"clean_count",
|
||||
2,
|
||||
@@ -151,3 +159,44 @@ async def test_unknown_status(
|
||||
|
||||
assert clean.status is Status.UnknownInternal
|
||||
assert "Got unknown status code: 123" in caplog.text
|
||||
|
||||
|
||||
@clean
|
||||
@pytest.mark.parametrize(
|
||||
("setting", "value", "exc", "exc_message"),
|
||||
[
|
||||
pytest.param(
|
||||
"vacuum_fan_speed",
|
||||
"invalid speed",
|
||||
ValueError,
|
||||
"Invalid fan speed",
|
||||
id="vacuum_fan_speed",
|
||||
),
|
||||
pytest.param(
|
||||
"carpet_clean_mode",
|
||||
"invalid mode",
|
||||
ValueError,
|
||||
"Invalid carpet clean mode",
|
||||
id="carpet_clean_mode",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_invalid_settings(
|
||||
dev: SmartDevice,
|
||||
mocker: MockerFixture,
|
||||
setting: str,
|
||||
value: str,
|
||||
exc: type[Exception],
|
||||
exc_message: str,
|
||||
):
|
||||
"""Test invalid settings."""
|
||||
clean = next(get_parent_and_child_modules(dev, Module.Clean))
|
||||
|
||||
# Not using feature.set_value() as it checks for valid values
|
||||
setter_name = dev.features[setting].attribute_setter
|
||||
assert isinstance(setter_name, str)
|
||||
|
||||
setter = getattr(clean, setter_name)
|
||||
|
||||
with pytest.raises(exc, match=exc_message):
|
||||
await setter(value)
|
||||
|
Reference in New Issue
Block a user