test_moebot.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.BATTERY
  46. | VacuumEntityFeature.CLEAN_SPOT
  47. | VacuumEntityFeature.PAUSE
  48. | VacuumEntityFeature.RETURN_HOME
  49. | VacuumEntityFeature.SEND_COMMAND
  50. | VacuumEntityFeature.START
  51. | VacuumEntityFeature.STATE
  52. | VacuumEntityFeature.STATUS
  53. | VacuumEntityFeature.STOP
  54. ),
  55. )
  56. async def test_async_stop(self):
  57. async with assert_device_properties_set(
  58. self.subject._device,
  59. {COMMAND_DP: "CancelWork"},
  60. ):
  61. await self.subject.async_stop()