Просмотр исходного кода

Kyvol vacuum: Correction to fan speed values

As observed in the comments of issue #124, the local protocol uses numeric enum
values rather than the strings from the cloud protocol for the "suction" dp.
Jason Rumney 4 лет назад
Родитель
Сommit
9ba7ed83ce

+ 5 - 5
custom_components/tuya_local/devices/kyvol_e30_vacuum.yaml

@@ -75,15 +75,15 @@ primary_entity:
       type: string
       name: fan_speed
       mapping:
-        - dps_val: strong
+        - dps_val: "0"
           value: strong
-        - dps_val: normal
+        - dps_val: "1"
           value: normal
-        - dps_val: quiet
+        - dps_val: "2"
           value: quiet
-        - dps_val: gentle
+        - dps_val: "3"
           value: gentle
-        - dps_val: closed
+        - dps_val: "4"
           value: closed
 #    - id: 15
 #      type: string

+ 2 - 4
tests/devices/test_kyvol_e30_vacuum.py

@@ -279,7 +279,7 @@ class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase)
             await self.subject.async_send_command("stop")
 
     def test_fan_speed(self):
-        self.dps[FAN_DPS] = "quiet"
+        self.dps[FAN_DPS] = "2"
         self.assertEqual(self.subject.fan_speed, "quiet")
 
     def test_fan_speed_list(self):
@@ -295,7 +295,5 @@ class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase)
         )
 
     async def test_async_set_fan_speed(self):
-        async with assert_device_properties_set(
-            self.subject._device, {FAN_DPS: "gentle"}
-        ):
+        async with assert_device_properties_set(self.subject._device, {FAN_DPS: "3"}):
             await self.subject.async_set_fan_speed("gentle")