浏览代码

Modify smart switch timers.

Timers are generally in seconds, even though the Tuya app only lets you set minutes.  Scale them into minutes, as second range timeouts are not commonly useful.

Issue #102
Jason Rumney 4 年之前
父节点
当前提交
d02e45f32f

+ 4 - 1
custom_components/tuya_local/devices/smartplugv1.yaml

@@ -74,4 +74,7 @@ secondary_entities:
         unit: min
         range:
           min: 0
-          max: 1440
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60

+ 5 - 1
custom_components/tuya_local/devices/smartplugv2.yaml

@@ -74,4 +74,8 @@ secondary_entities:
         unit: min
         range:
           min: 0
-          max: 1440
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+

+ 4 - 1
custom_components/tuya_local/devices/smartplugv2_energy.yaml

@@ -42,7 +42,10 @@ secondary_entities:
         unit: min
         range:
           min: 0
-          max: 1440
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
   - entity: sensor
     category: diagnostic
     class: energy

+ 2 - 1
tests/devices/test_smartplugv1.py

@@ -35,8 +35,9 @@ class TestKoganSwitch(
         self.setUpBasicNumber(
             TIMER_DPS,
             self.entities.get("number_timer"),
-            max=1440,
+            max=1440.0,
             unit=TIME_MINUTES,
+            scale=60,
         )
         self.setUpMultiSensors(
             [

+ 2 - 1
tests/devices/test_smartplugv2.py

@@ -35,8 +35,9 @@ class TestSwitchV2(
         self.setUpBasicNumber(
             TIMER_DPS,
             self.entities.get("number_timer"),
-            max=1440,
+            max=1440.0,
             unit=TIME_MINUTES,
+            scale=60,
         )
         self.setUpMultiSensors(
             [

+ 2 - 1
tests/devices/test_smartplugv2_energy.py

@@ -73,8 +73,9 @@ class TestSwitchV2Energy(
         self.setUpBasicNumber(
             TIMER_DPS,
             self.entities.get("number_timer"),
-            max=1440,
+            max=1440.0,
             unit=TIME_MINUTES,
+            scale=60,
         )
         self.setUpBasicSelect(
             INITIAL_DPS,