Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom_components/robovac/vacuums/T2275.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class T2275(RobovacModelDetails):
RobovacCommand.RETURN_HOME: {
"code": 153,
"values": {
"return_home": "AggB",
"return": "AggB",
},
},
RobovacCommand.CLEAN_PARAM: {
Expand Down
7 changes: 1 addition & 6 deletions custom_components/robovac/vacuums/T2280.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ class T2280(RobovacModelDetails):
RobovacCommand.STATUS: {
"code": 173,
},
RobovacCommand.RETURN_HOME: {
"code": 153,
"values": {
"return_home": "AggB",
}
},
RobovacCommand.RETURN_HOME: {"code": 153},
RobovacCommand.FAN_SPEED: {
"code": 154,
"values": {
Expand Down
1 change: 0 additions & 1 deletion custom_components/robovac/vacuums/T2320.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class T2320(RobovacModelDetails):
RobovacCommand.RETURN_HOME: {
"code": 153,
"values": {
"return_home": True,
"return": True,
},
},
Expand Down
2 changes: 1 addition & 1 deletion custom_components/robovac/vacuums/T2351.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class T2351(RobovacModelDetails):
RobovacCommand.STATUS: {
"code": 173,
},
RobovacCommand.RETURN_HOME: {"code": 153, "values": {"return_home": True}},
RobovacCommand.RETURN_HOME: {"code": 153, "values": {"return": True}},
RobovacCommand.FAN_SPEED: {
"code": 154,
"values": {
Expand Down
12 changes: 0 additions & 12 deletions tests/test_vacuum/test_t2275_command_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ def test_t2275_mode_command_values(mock_t2275_robovac) -> None:
assert mock_t2275_robovac.getRoboVacCommandValue(RobovacCommand.MODE, "unknown") == "unknown"


def test_t2275_return_home_command_values(mock_t2275_robovac) -> None:
"""Test T2275 RETURN_HOME value mapping."""
assert (
mock_t2275_robovac.getRoboVacCommandValue(RobovacCommand.RETURN_HOME, "return_home")
== "AggB"
)
assert (
mock_t2275_robovac.getRoboVacCommandValue(RobovacCommand.RETURN_HOME, "unknown")
== "unknown"
)


def test_t2275_fan_speed_command_values(mock_t2275_robovac) -> None:
"""Test T2275 FAN_SPEED maps HA selections to direct fan speed values."""
assert mock_t2275_robovac.getRoboVacCommandValue(RobovacCommand.FAN_SPEED, "quiet") == "Quiet"
Expand Down
6 changes: 0 additions & 6 deletions tests/test_vacuum/test_t2320_command_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def t2320_robovac() -> RoboVac:
class TestT2320CommandMappings:
"""Test T2320 command mappings match debug log expectations."""

def test_return_home_command_value(self, t2320_robovac):
"""Test RETURN_HOME command returns boolean true as seen in debug logs."""
# Debug log shows: "dps": {"153": true}
result = t2320_robovac.getRoboVacCommandValue(RobovacCommand.RETURN_HOME, "return_home")
assert result is True

def test_start_pause_command_exists(self, t2320_robovac):
"""Test START_PAUSE command is defined for T2320."""
# Debug log shows: "dps": {"2": false}
Expand Down
31 changes: 31 additions & 0 deletions tests/test_vacuum/test_vacuum_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,37 @@ async def test_async_return_to_base(mock_robovac, mock_vacuum_data) -> None:
mock_robovac.async_set.assert_called_once_with({"101": "return"})


@pytest.mark.asyncio
@pytest.mark.parametrize(
("model_code", "expected_payload"),
[
("T2275", {"153": "AggB"}),
("T2351", {"153": True}),
],
)
async def test_async_return_to_base_uses_model_specific_value(
mock_vacuum_data,
model_code,
expected_payload,
) -> None:
"""Test return-to-base sends each model's device-specific DPS value."""
with patch("custom_components.robovac.robovac.TuyaDevice.__init__", return_value=None):
robovac = RoboVac(
model_code=model_code,
device_id="test_id",
host="192.168.1.100",
local_key="test_key",
)
robovac.async_set = AsyncMock(return_value=True)

model_data = {**mock_vacuum_data, CONF_MODEL: model_code}
with patch("custom_components.robovac.vacuum.RoboVac", return_value=robovac):
entity = RoboVacEntity(model_data)
await entity.async_return_to_base()

robovac.async_set.assert_awaited_once_with(expected_payload)


@pytest.mark.asyncio
async def test_async_start(mock_robovac, mock_vacuum_data) -> None:
"""Test the async_start method."""
Expand Down
Loading