test_duux_blizzard.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. from homeassistant.components.climate.const import HVACMode
  2. from ..const import DUUX_BLIZZARD_PAYLOAD
  3. from ..helpers import assert_device_properties_set
  4. from ..mixins.climate import TargetTemperatureTests
  5. from .base_device_tests import TuyaDeviceTestCase
  6. POWER_DP = "1"
  7. MODE_DP = "2"
  8. SPEED_DP = "3"
  9. TIMER_DP = "4"
  10. TEMPERATURE_DP = "5"
  11. SLEEP_DP = "6"
  12. ION_DP = "7"
  13. CURRENTTEMP_DP = "8"
  14. FAULT_DP = "9"
  15. SETTEMPF_DP = "10"
  16. CURTEMPF_DP = "11"
  17. IONSHOW_DP = "12"
  18. HEATSHOW_DP = "13"
  19. UNIT_DP = "14"
  20. COUNTDOWN_DP = "15"
  21. class TestDuuxBlizzard(TargetTemperatureTests, TuyaDeviceTestCase):
  22. __test__ = True
  23. def setUp(self):
  24. self.setUpForConfig(
  25. "duux_blizzard_portable_aircon.yaml",
  26. DUUX_BLIZZARD_PAYLOAD,
  27. )
  28. self.subject = self.entities.get("climate")
  29. self.ionizer = self.entities.get("switch_ionizer")
  30. self.setUpTargetTemperature(
  31. TEMPERATURE_DP,
  32. self.subject,
  33. min=18.0,
  34. max=32.0,
  35. )
  36. self.mark_secondary(
  37. [
  38. "number_timer",
  39. "switch_sleep",
  40. "switch_ionizer",
  41. "binary_sensor_tank_full",
  42. "binary_sensor_problem",
  43. "select_temperature_unit",
  44. "sensor_time_remaining",
  45. ]
  46. )
  47. def test_hvac_modes_with_heat_disabled(self):
  48. self.dps[HEATSHOW_DP] = False
  49. self.assertCountEqual(
  50. self.subject.hvac_modes,
  51. [
  52. HVACMode.OFF,
  53. HVACMode.COOL,
  54. HVACMode.DRY,
  55. HVACMode.FAN_ONLY,
  56. HVACMode.AUTO,
  57. ],
  58. )
  59. def test_hvac_modes_with_heat_enabled(self):
  60. self.dps[HEATSHOW_DP] = True
  61. self.assertCountEqual(
  62. self.subject.hvac_modes,
  63. [
  64. HVACMode.OFF,
  65. HVACMode.COOL,
  66. HVACMode.DRY,
  67. HVACMode.FAN_ONLY,
  68. HVACMode.AUTO,
  69. HVACMode.HEAT,
  70. ],
  71. )
  72. def test_ionizer_availability(self):
  73. self.dps[IONSHOW_DP] = False
  74. self.dps[ION_DP] = True
  75. self.assertFalse(self.ionizer.available)
  76. self.dps[IONSHOW_DP] = True
  77. self.assertTrue(self.ionizer.available)
  78. async def test_set_redirected_temperature(self):
  79. self.dps[UNIT_DP] = True # Fahrenheit
  80. async with assert_device_properties_set(
  81. self.subject._device,
  82. {SETTEMPF_DP: 75},
  83. ):
  84. await self.subject.async_set_target_temperature(75)