소스 검색

tests(goldair_portable_airconditioner): update tests for swing mode changes

Horizontal swing mode is now mapped according to the device info from
tuya, instead of being swapped with the vertical swing to suit HA
requirement for a single swing to be vertical.

Fix typo in config for remapped swing_mode

Issue #3496
Jason Rumney 10 달 전
부모
커밋
d562b47298
2개의 변경된 파일11개의 추가작업 그리고 12개의 파일을 삭제
  1. 1 1
      custom_components/tuya_local/devices/goldair_portable_airconditioner.yaml
  2. 10 11
      tests/devices/test_goldair_portable_airconditioner.py

+ 1 - 1
custom_components/tuya_local/devices/goldair_portable_airconditioner.yaml

@@ -165,7 +165,7 @@ entities:
           - dps_val: false
             value: "off"
             available: support_both_swing
-      - id: 10
+      - id: 110
         type: boolean
         name: swing_real_horizontal_mode
         mapping:

+ 10 - 11
tests/devices/test_goldair_portable_airconditioner.py

@@ -13,7 +13,7 @@ CURRENT_TEMPERATURE_DP = "3"
 MODE_DP = "4"
 FANMODE_DP = "5"
 IONIZER_DP = "11"
-SWINGH_DP = "15"
+SWINGV_DP = "15"
 FAULT_DP = "20"
 SLEEP_DP = "103"
 ONTIMER_DP = "104"
@@ -21,7 +21,7 @@ OFFTIMER_DP = "105"
 TEMPF_DP = "107"
 CURTEMPF_DP = "108"
 FEATURE_DP = "109"
-SWINGV_DP = "110"
+SWINGH_DP = "110"
 
 
 class TestGoldairPortableAir(TargetTemperatureTests, TuyaDeviceTestCase):
@@ -50,10 +50,9 @@ class TestGoldairPortableAir(TargetTemperatureTests, TuyaDeviceTestCase):
 
     def test_swing_modes_with_vswing_unavailable(self):
         self.dps[FEATURE_DP] = 26
-        self.assertCountEqual(self.subject.swing_modes, [])
-        self.assertCountEqual(
-            self.subject.swing_horizontal_modes, [SWING_OFF, SWING_ON]
-        )
+        # config should arrange for hswing to move to swing_mode in this case
+        self.assertCountEqual(self.subject.swing_horizontal_modes, [])
+        self.assertCountEqual(self.subject.swing_modes, [SWING_OFF, SWING_ON])
 
     def test_swing_modes_with_vswing_available(self):
         self.dps[FEATURE_DP] = 27
@@ -64,14 +63,14 @@ class TestGoldairPortableAir(TargetTemperatureTests, TuyaDeviceTestCase):
 
     def test_swing(self):
         self.dps[FEATURE_DP] = 27
-        self.dps[SWINGH_DP] = "on"
-        self.dps[SWINGV_DP] = True
+        self.dps[SWINGV_DP] = "on"
+        self.dps[SWINGH_DP] = True
         self.assertEqual(self.subject.swing_mode, SWING_ON)
         self.assertEqual(self.subject.swing_horizontal_mode, SWING_ON)
-        self.dps[SWINGH_DP] = "off"
-        self.assertEqual(self.subject.swing_horizontal_mode, SWING_OFF)
-        self.dps[SWINGV_DP] = False
+        self.dps[SWINGV_DP] = "off"
         self.assertEqual(self.subject.swing_mode, SWING_OFF)
+        self.dps[SWINGH_DP] = False
+        self.assertEqual(self.subject.swing_horizontal_mode, SWING_OFF)
 
     def test_available(self):
         """Override the base class, as this has availability logic."""