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

feat (krain_krx8_irrigation_controller): fix program dps, add KRX6

- KRX6 is basically a cut down version with 2 less outputs and 1 less program.
Using availability flags, we can basically handle this type of compatibility
in a single config now, so merged in from PR #4759 by @camcamnz

Previously we used a switch for "start_a" etc and labelled as "Program A"
etc. And we ignored the "start_a_enable" etc. This was noted in #3738
as an uncertainty because without further info it was not possible to
guess as to how these interacted, and the available logs did not
include the latter. Due to info on #4759, we now understand that the
"start_a" is to immediately start a program, and "start_a_enable"
enables automatic running of that program, so the former should be
buttons and the latter switches.
Jason Rumney 2 дней назад
Родитель
Сommit
ed82010c77

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -1315,3 +1315,4 @@ Further device support has been made with the assistance of users. Please consid
 - [lfrlucas](https://github.com/lfrlucas) for contributing support for Emini 16A Public EV charger.
 - [tfmm](https://github.com/tfmm) for assisting with support for ComfortZone AP100 air purifier.
 - [subpanel0576](https://github.com/subpanel0576) for assisting with support for V Jules.V SK17 galaxy projector.
+- [camcamnz](https://github.com/camcamnz) for contributing support for KRain KRX6 irrigation controller, which was merged with KRX8.

+ 1 - 1
DEVICES.md

@@ -1166,7 +1166,7 @@ port and password.
 - Holman WX1 tap timer (sprinkler controller)
 - Holman WX2 dual tap timer
 - Holman WX8 8 sprinkler irrigation controller
-- KRain KRX8 irrigation controller
+- KRain KRX8 (also KRX6) irrigation controller
 - Neo NAS-WV02W water use monitoring valve
 - Neptun Smart and Smart+ water leak control systems
 - Qoto 03 smart water valve / sprinkler controller

+ 106 - 19
custom_components/tuya_local/devices/krain_krx8_irrigation_controller.yaml

@@ -3,6 +3,9 @@ products:
   - id: o4lzusmr4igv5ux3
     manufacturer: KRain
     model: KRX8
+  - id: 9lgavgvaygh8ibgs
+    manufacturer: KRain
+    model: KRX6
 entities:
   - entity: switch
     category: config
@@ -63,54 +66,138 @@ entities:
   - entity: valve
     name: Zone 7
     class: water
+    hidden: unavailable
     dps:
       - id: 107
         type: boolean
+        optional: true
         name: valve
+      - id: 107
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: valve
     name: Zone 8
     class: water
+    hidden: unavailable
     dps:
       - id: 108
         type: boolean
+        optional: true
         name: valve
+      - id: 108
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: button
+    name: Start A
+    icon: "mdi:timer-play"
+    category: config
+    dps:
+      - id: 117
+        type: boolean
+        name: button
+  - entity: button
+    name: Start B
+    icon: "mdi:timer-play"
+    category: config
+    dps:
+      - id: 118
+        type: boolean
+        name: button
+  - entity: button
+    name: Start C
+    icon: "mdi:timer-play"
+    category: config
+    dps:
+      - id: 119
+        type: boolean
+        name: button
+  - entity: button
+    name: Start D
+    icon: "mdi:timer-play"
+    category: config
+    hidden: unavailable
+    dps:
+      - id: 120
+        type: boolean
+        optional: true
+        name: button
+      - id: 120
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    name: Enable programs
+    icon: "mdi:calendar-check"
+    dps:
+      - id: 121
+        type: boolean
+        name: switch
   - entity: switch
     name: Program A
     icon: "mdi:timetable"
     category: config
     dps:
-      - id: 117
+      - id: 122
         type: boolean
         name: switch
+      - id: 121
+        type: boolean
+        name: available
   - entity: switch
     name: Program B
     icon: "mdi:timetable"
     category: config
     dps:
-      - id: 118
+      - id: 123
         type: boolean
         name: switch
+      - id: 121
+        type: boolean
+        name: available
   - entity: switch
     name: Program C
     icon: "mdi:timetable"
     dps:
-      - id: 119
+      - id: 124
         type: boolean
         name: switch
+      - id: 121
+        type: boolean
+        name: available
   - entity: switch
     name: Program D
     icon: "mdi:timetable"
+    hidden: unavailable
     dps:
-      - id: 120
+      - id: 125
         type: boolean
+        optional: true
         name: switch
-  - entity: switch
-    name: Enable programs
-    icon: "mdi:calendar-check"
-    dps:
+      - id: 125
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value_redirect: enabled
       - id: 121
         type: boolean
-        name: switch
+        name: enabled
   - entity: binary_sensor
     class: battery
     dps:
@@ -188,6 +275,16 @@ entities:
         type: base64
         optional: true
         name: value
+  - entity: text
+    name: Manual command
+    category: config
+    icon: "mdi:account-cog"
+    hidden: true
+    dps:
+      - id: 133
+        type: base64
+        optional: true
+        name: value
   - entity: sensor
     name: Watering delay
     class: duration
@@ -202,13 +299,3 @@ entities:
       - id: 134
         type: base64
         name: technical_info
-  - entity: text
-    name: Manual command
-    category: config
-    icon: "mdi:account-cog"
-    hidden: true
-    dps:
-      - id: 133
-        type: base64
-        optional: true
-        name: value