test_moebot.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. """
  2. Test MoeBot S mower.
  3. Primarily for testing the STOP command which this device is the first to use.
  4. """
  5. from homeassistant.components.vacuum import VacuumEntityFeature
  6. from ..const import MOEBOT_PAYLOAD
  7. from ..helpers import assert_device_properties_set
  8. from .base_device_tests import TuyaDeviceTestCase
  9. BATTERY_DP = "6"
  10. STATUS_DP = "101"
  11. ERROR_DP = "102"
  12. PROBLEM_DP = "103"
  13. RAINMODE_DP = "104"
  14. RUNTIME_DP = "105"
  15. PASSWD_DP = "106"
  16. CLEARSCHED_DP = "107"
  17. QUERYSCHED_DP = "108"
  18. QUERYZONE_DP = "109"
  19. SCHEDULE_DP = "110"
  20. ERRLOG_DP = "111"
  21. WORKLOG_DP = "112"
  22. ZONES_DP = "113"
  23. AUTOMODE_DP = "114"
  24. COMMAND_DP = "115"
  25. class TestMoebot(TuyaDeviceTestCase):
  26. __test__ = True
  27. def setUp(self):
  28. self.setUpForConfig("moebot_s_mower.yaml", MOEBOT_PAYLOAD)
  29. self.subject = self.entities.get("vacuum")
  30. self.mark_secondary(
  31. [
  32. "binary_sensor_error",
  33. "sensor_problem",
  34. "switch_rain_mode",
  35. "number_running_time",
  36. "button_clear_schedule",
  37. "button_query_schedule",
  38. "button_query_zones",
  39. ]
  40. )
  41. def test_supported_features(self):
  42. self.assertEqual(
  43. self.subject.supported_features,
  44. (
  45. VacuumEntityFeature.CLEAN_SPOT
  46. | VacuumEntityFeature.PAUSE
  47. | VacuumEntityFeature.RETURN_HOME
  48. | VacuumEntityFeature.SEND_COMMAND
  49. | VacuumEntityFeature.START
  50. | VacuumEntityFeature.STATE
  51. | VacuumEntityFeature.STATUS
  52. | VacuumEntityFeature.STOP
  53. ),
  54. )
  55. async def test_async_stop(self):
  56. async with assert_device_properties_set(
  57. self.subject._device,
  58. {COMMAND_DP: "CancelWork"},
  59. ):
  60. await self.subject.async_stop()