test_duux_blizzard.py 2.3 KB

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