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

Friedrich UCT08b10A air conditioner: tweaks from review

- same tweaks as previous changes to other Friedrich file
- use temperature unit to select which set of temperatures to use
- fix problem sensor (did not have a sensor dp)
Jason Rumney 1 год назад
Родитель
Сommit
6f34f66852
1 измененных файлов с 38 добавлено и 318 удалено
  1. 38 318
      custom_components/tuya_local/devices/friedrich_uct08b10a_airconditioner

+ 38 - 318
custom_components/tuya_local/devices/friedrich_uct08b10a_airconditioner

@@ -1,15 +1,7 @@
-name: Air Conditioner
+name: Air conditioner
 products:
   - id: jvnwkkvvshk3go8f
-    # https://www.friedrich.com/professional/products/uni-fit
-    # NB: Tuya calls this "Friedrich Window Unit" but these are through-the-wall units
-    name: Friedrich Uni-Fit Through-the-Wall Air Conditioner (Model UCT08B10A)
-
-# Even though the latest firmware for UCT08B10A exposes tons of DPs (very similar to Fisher Summer Air Conditioner)
-# after testing vast majority of them are unsupported. This unit is much closer to the other Friedrich Air Conditioners
-# in terms of actual capabilities but it's still different enough to warrant a separate yaml.
-# Note: we are forced to add all the DPs in order for the YAML configuration to be identified even though most of them
-# need to be made invisible and are not used by the hardware of the actual air conditioner.
+    name: Friedrich UCT08B10A
 primary_entity:
   entity: climate
   dps:
@@ -37,14 +29,15 @@ primary_entity:
       type: integer
       name: current_temperature_in_c
       optional: true
-      unit: C
     - id: 23
       name: current_temperature
       type: integer
       optional: true
-      range:
-        min: -20
-        max: 100
+      mapping:
+        - constraint: temperature_unit
+          conditions:
+            - dps_val: c
+              value_redirect: current_temperature_in_c
     - id: 24
       type: integer
       name: temperature
@@ -56,6 +49,11 @@ primary_entity:
       mapping:
         - scale: 10
           step: 10
+          constraint: temperature_unit
+          conditions:
+            - dps_val: c
+              value_redirect: temperature_in_c
+        step: 5
     - id: 2
       name: temperature_in_c
       type: integer
@@ -67,6 +65,14 @@ primary_entity:
         - scale: 10
           step: 5
       unit: C
+    - id: 19
+      type: string
+      name: temperature_unit
+      mapping:
+        - dps_val: f
+          value: F
+        - dps_val: c
+          value: C
     - id: 4
       type: string
       name: mode
@@ -100,17 +106,14 @@ primary_entity:
     - id: 123
       name: preset_mode
       type: hex
+      mask: "0001"
       mapping:
-        - mask: "0001"
         - dps_val: 0
-          mask: "0001"
           value: comfort
         - dps_val: 1
           value: eco
-          mask: "0001"
         - dps_val: null
           value: comfort
-          mask: "0001"
           hidden: true
     - id: 128
       name: style
@@ -120,290 +123,11 @@ primary_entity:
           value: wall
         - dps_val: "1"
           value: floor
-        - dps_val: "2"
-          value: missing mapping
         - dps_val: "3"
           value: through-the-wall
-    - id: 8
-      name: legacy_preset_mode
-      type: boolean
-      optional: true
-    - id: 18
-      name: unsupported_current_humidity
-      type: integer
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 101
-      name: sleep_legacy_unreported
-      type: integer
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 102
-      name: temp_conversion_unit_legacy
-      type: boolean
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: true
-          value: "°F"
-        - dps_val: false
-          value: "°C"
-    - id: 110
-      name: hswing_available
-      type: bitfield
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: 32
-          value: true
-        - value: false
-    - id: 113
-      name: option
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "0"
-          value: None
-          default: true
-        - dps_val: "1"
-          value: Upper and lower
-        - dps_val: "2"
-          value: Upper
-        - dps_val: "3"
-          value: Lower
-    - id: 114
-      name: option
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "0"
-          value: "Off"
-          default: true
-        - dps_val: "1"
-          value: Left and Right
-        - dps_val: "2"
-          value: Left
-        - dps_val: "3"
-          value: Middle
-        - dps_val: "4"
-          value: Right
-        - dps_val: "5"
-          value: Partial Left
-        - dps_val: "6"
-          value: Partial Right
-        - dps_val: "7"
-          value: Wide Angle
-    - id: 115
-      type: integer
-      name: total_n
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 116
-      name: totalp
-      type: integer
-      # unclear what this is, seems like intended to be total power but it's unitless per IOT and doesn't exactly track
-      # what the unit is doing so leaving as a diagnostic-only sensor that should probably be disabled by the user
-      hidden: true
-      optional: true
-      # from tuya iot dev
-      range:
-        min: 0
-        max: 1000000
-    - id: 119
-      name: psaving
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "0"
-          value: None
-          default: true
-        - dps_val: "1"
-          value: Default Power Saving
-        - dps_val: "2"
-          value: Quota Power Saving
-        - dps_val: "3"
-          value: Fixed Temperature Power Saving
-    - id: 120
-      name: llevel
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "off"
-          value: None
-          default: true
-        - dps_val: L1
-          value: L1
-        - dps_val: L2
-          value: L2
-        - dps_val: L3
-          value: L3
-    - id: 125
-      name: air_quality
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 126
-      name: vertical_direction
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "0"
-          value: Freeze Current Position
-          default: true
-        - dps_val: "1"
-          value: Top
-        - dps_val: "2"
-          value: Slightly Up
-        - dps_val: "3"
-          value: Middle
-        - dps_val: "4"
-          value: Slightly Down
-        - dps_val: "5"
-          value: Down
-    - id: 127
-      name: fan_orientation
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: "0"
-          value: Freeze current position
-          default: true
-        - dps_val: "1"
-          value: Left
-        - dps_val: "2"
-          value: Slightly left
-        - dps_val: "3"
-          value: Middle
-        - dps_val: "4"
-          value: Slightly right
-        - dps_val: "5"
-          value: Right
-        - dps_val: "6"
-          value: Wide angle left
-        - dps_val: "7"
-          value: Wide angle right
-        - dps_val: "8"
-          value: Wide angle
-    - id: 129
-      type: string
-      name: power_picker
-      mapping:
-        - dps_val: 1
-          value: 1 kWh
-        - dps_val: 2
-          value: 2 kWh
-        - dps_val: 3
-          value: 3 kWh
-        - dps_val: 4
-          value: 4 kWh
-        - dps_val: 5
-          value: 5 kWh
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 130
-      name: eco_mode_temperature_setting
-      type: integer
-      unit: C
-      range:
-        min: 26
-        max: 31
-      optional: true
-    - id: 131
-      type: boolean
-      name: dirty_filter
-      readonly: true
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 132
-      name: is_fan_air_cold
-      type: boolean
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      mapping:
-        - dps_val: true
-          value: Cold Wind
-        - dps_val: false
-          value: Hot wind
-    - id: 133
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-      name: swing_support
-      type: string
-      mapping:
-        - dps_val: "0"
-          value: "off"
-        - dps_val: "1"
-          value: horizontal
-          available: hswing_available
-        - dps_val: "2"
-          value: vertical
-        - dps_val: "3"
-          value: both
-          available: hswing_available
-    - id: 134
-      name: working_time
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 135
-      name: running_time
-      type: integer
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
-    - id: 136
-      name: dr_energy_function
-      type: string
-      # the unit's actual hardware doesn't support this functionality even though the firmware / DP is exposed
-      # we are forced to add it so that Tuya Local gets to 100% DP match and allows us to pick this YAML for this unit
-      hidden: true
-      optional: true
 
 secondary_entities:
   - entity: switch
-    name: "Sleep Mode"
-    icon: "mdi:sleep"
     translation_key: sleep
     category: config
     dps:
@@ -417,33 +141,29 @@ secondary_entities:
             # "normal",
             # "old",
             # "child"
-          - dps_val: "normal"
+          - dps_val: "child"
             value: true
           - dps_val: "off"
             value: false
-          - value: false
-  - entity: sensor
-    name: "Configured Temperature Unit"
-    category: diagnostic
-    class: enum
-    dps:
-      - id: 19
-        name: sensor
-        type: string
-        optional: true
-        mapping:
-          - dps_val: "f"
-            value: "°F"
-            icon: "mdi:temperature-fahrenheit"
-            icon_priority: 2
-          - dps_val: "c"
-            value: "°C"
-            icon: "mdi:temperature-celsius"
-            icon_priority: 2
+          - value: true
+            hidden: true
   - entity: binary_sensor
     class: problem
     category: diagnostic
     dps:
+      - id: 20
+        type: bitfield
+        name: sensor
+        mapping:
+          - dps_val: 0
+            value: true
+            constraint: fault2
+            conditions:
+              - dps_val: 0
+                value: false
+              - dps_val: null
+                value: false
+          - value: true
       - id: 20
         type: bitfield
         name: fault_code
@@ -452,7 +172,7 @@ secondary_entities:
         type: bitfield
         optional: true
   - entity: number
-    name: Eco Mode Temperature Setting
+    name: Eco temperature
     category: config
     class: temperature
     dps: