|
|
@@ -1,9 +1,13 @@
|
|
|
"""
|
|
|
Test MoeBot S mower.
|
|
|
-Primarily for testing the STOP command which this device is the first to use.
|
|
|
+Primarily for testing the STOP command which this device is the first to use,
|
|
|
+and the lawn_mower platform.
|
|
|
"""
|
|
|
from homeassistant.components.vacuum import VacuumEntityFeature
|
|
|
-
|
|
|
+from homeassistant.components.lawn_mower.const import (
|
|
|
+ LawnMowerActivity,
|
|
|
+ LawnMowerEntityFeature,
|
|
|
+)
|
|
|
from ..const import MOEBOT_PAYLOAD
|
|
|
from ..helpers import assert_device_properties_set
|
|
|
from .base_device_tests import TuyaDeviceTestCase
|
|
|
@@ -32,6 +36,7 @@ class TestMoebot(TuyaDeviceTestCase):
|
|
|
def setUp(self):
|
|
|
self.setUpForConfig("moebot_s_mower.yaml", MOEBOT_PAYLOAD)
|
|
|
self.subject = self.entities.get("vacuum")
|
|
|
+ self.mower = self.entities.get("lawn_mower")
|
|
|
self.mark_secondary(
|
|
|
[
|
|
|
"binary_sensor_error",
|
|
|
@@ -58,6 +63,14 @@ class TestMoebot(TuyaDeviceTestCase):
|
|
|
| VacuumEntityFeature.STOP
|
|
|
),
|
|
|
)
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.supported_features,
|
|
|
+ (
|
|
|
+ LawnMowerEntityFeature.START_MOWING
|
|
|
+ | LawnMowerEntityFeature.PAUSE
|
|
|
+ | LawnMowerEntityFeature.DOCK
|
|
|
+ ),
|
|
|
+ )
|
|
|
|
|
|
async def test_async_stop(self):
|
|
|
async with assert_device_properties_set(
|
|
|
@@ -65,3 +78,76 @@ class TestMoebot(TuyaDeviceTestCase):
|
|
|
{COMMAND_DP: "CancelWork"},
|
|
|
):
|
|
|
await self.subject.async_stop()
|
|
|
+
|
|
|
+ def test_lawnmower_activity(self):
|
|
|
+ self.dps[STATUS_DP] = "ERROR"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.ERROR
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "EMERGENCY"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.ERROR
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "PAUSED"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.PAUSED
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "PARK"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.PAUSED
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "MOWING"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.MOWING
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "FIXED_MOWING"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.MOWING
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "STANDBY"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.DOCKED
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "CHARGING"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.DOCKED
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "LOCKED"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.DOCKED
|
|
|
+ )
|
|
|
+ self.dps[STATUS_DP] = "CHARGING_WITH_TASK_SUSPEND"
|
|
|
+ self.assertEqual(
|
|
|
+ self.mower.activity,
|
|
|
+ LawnMowerActivity.DOCKED
|
|
|
+ )
|
|
|
+
|
|
|
+ async def test_async_start_mowing(self):
|
|
|
+ async with assert_device_properties_set(
|
|
|
+ self.mower._device,
|
|
|
+ {COMMAND_DP: "StartMowing"},
|
|
|
+ ):
|
|
|
+ await self.mower.async_start_mowing()
|
|
|
+
|
|
|
+ async def test_async_pause(self):
|
|
|
+ async with assert_device_properties_set(
|
|
|
+ self.mower._device,
|
|
|
+ {COMMAND_DP: "PauseWork"},
|
|
|
+ ):
|
|
|
+ await self.mower.async_pause()
|
|
|
+
|
|
|
+ async def test_async_dock(self):
|
|
|
+ async with assert_device_properties_set(
|
|
|
+ self.mower._device,
|
|
|
+ {COMMAND_DP: "StartReturnStation"},
|
|
|
+ ):
|
|
|
+ await self.mower.async_dock()
|