test_qoto_03_sprinkler.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. """Tests for the Quto 03 Sprinkler."""
  2. from homeassistant.components.binary_sensor import DEVICE_CLASS_PROBLEM
  3. from ..const import QOTO_SPRINKLER_PAYLOAD
  4. from ..mixins.binary_sensor import BasicBinarySensorTests
  5. from ..mixins.number import MultiNumberTests
  6. from ..mixins.sensor import MultiSensorTests
  7. from .base_device_tests import TuyaDeviceTestCase
  8. TARGET_DPS = "102"
  9. CURRENT_DPS = "103"
  10. COUNTDOWN_DPS = "104"
  11. TIMER_DPS = "105"
  12. ERROR_DPS = "108"
  13. class TestQoboSprinkler(
  14. BasicBinarySensorTests,
  15. MultiNumberTests,
  16. MultiSensorTests,
  17. TuyaDeviceTestCase,
  18. ):
  19. __test__ = True
  20. def setUp(self):
  21. self.setUpForConfig("qoto_03_sprinkler.yaml", QOTO_SPRINKLER_PAYLOAD)
  22. self.setUpBasicBinarySensor(
  23. ERROR_DPS,
  24. self.entities.get("binary_sensor_error"),
  25. device_class=DEVICE_CLASS_PROBLEM,
  26. testdata=(1, 0),
  27. )
  28. self.setUpMultiNumber(
  29. [
  30. {
  31. "name": "number",
  32. "dps": TARGET_DPS,
  33. "max": 100,
  34. "step": 5,
  35. },
  36. {
  37. "name": "number_timer",
  38. "dps": TIMER_DPS,
  39. "max": 86399,
  40. },
  41. ]
  42. )
  43. self.setUpMultiSensors(
  44. [
  45. {
  46. "name": "sensor_open",
  47. "dps": CURRENT_DPS,
  48. "unit": "%",
  49. },
  50. {
  51. "name": "sensor_timer",
  52. "dps": COUNTDOWN_DPS,
  53. "unit": "s",
  54. },
  55. ]
  56. )