Przeglądaj źródła

Humidifier: add current_humidity

HA 2023.7 moves the current humidity into the humidifier platform, so
that the UI can be harmonised with climate entities.

Add this attribute, and modifiy all humidifier configs to define the
attribute and deprecate the separate sensor.

Issue #869
Jason Rumney 2 lat temu
rodzic
commit
da8e86691e
35 zmienionych plików z 139 dodań i 75 usunięć
  1. 2 1
      custom_components/tuya_local/devices/README.md
  2. 4 0
      custom_components/tuya_local/devices/alecoair_d12_dehumidifier.yaml
  3. 4 0
      custom_components/tuya_local/devices/alecoair_d12_home_dehumidifier.yaml
  4. 4 0
      custom_components/tuya_local/devices/alecoair_d14_dehumidifier.yaml
  5. 4 0
      custom_components/tuya_local/devices/alecoair_d16_dehumidifier.yaml
  6. 4 0
      custom_components/tuya_local/devices/blitzwolf_bwsh5_humidifier.yaml
  7. 4 0
      custom_components/tuya_local/devices/ebac_dj4000_dehumidifier.yaml
  8. 4 0
      custom_components/tuya_local/devices/eeese_carl_dehumidifier.yaml
  9. 4 0
      custom_components/tuya_local/devices/eeese_otto_dehumidifier.yaml
  10. 4 0
      custom_components/tuya_local/devices/eesee_adam_dehumidifier.yaml
  11. 4 1
      custom_components/tuya_local/devices/electriq_cd12pro_dehumidifier.yaml
  12. 1 4
      custom_components/tuya_local/devices/electriq_cd12pw_dehumidifier.yaml
  13. 1 3
      custom_components/tuya_local/devices/electriq_cd12pwv2_dehumidifier.yaml
  14. 1 10
      custom_components/tuya_local/devices/electriq_cd20pro_dehumidifier.yaml
  15. 1 7
      custom_components/tuya_local/devices/electriq_cd25pro_dehumidifier.yaml
  16. 4 0
      custom_components/tuya_local/devices/electriq_pd45e_dehumidifier.yaml
  17. 1 10
      custom_components/tuya_local/devices/goldair_dehumidifier.yaml
  18. 4 0
      custom_components/tuya_local/devices/goldair_gpdh340_dehumidifier.yaml
  19. 1 0
      custom_components/tuya_local/devices/greenwind_dehumidifier.yaml
  20. 1 4
      custom_components/tuya_local/devices/honeywell_dehumidifier.yaml
  21. 4 0
      custom_components/tuya_local/devices/hyundai_sahara_dehumidifier.yaml
  22. 4 0
      custom_components/tuya_local/devices/inventor_atmospherexl_dehumidifier.yaml
  23. 4 0
      custom_components/tuya_local/devices/inventor_evaionpro_dehumidifier.yaml
  24. 4 5
      custom_components/tuya_local/devices/jjpro_jpd01_dehumidifier.yaml
  25. 4 3
      custom_components/tuya_local/devices/jjpro_jpd02_dehumidifier.yaml
  26. 4 0
      custom_components/tuya_local/devices/klarstein_dryfy_pro_connect_dehumidifier.yaml
  27. 4 0
      custom_components/tuya_local/devices/klarta_humea_humidifier.yaml
  28. 1 3
      custom_components/tuya_local/devices/kogan_dehumidifier.yaml
  29. 4 0
      custom_components/tuya_local/devices/shinco_30d_dehumidifier.yaml
  30. 4 0
      custom_components/tuya_local/devices/stadlerform_eva_humidifier.yaml
  31. 4 0
      custom_components/tuya_local/devices/stadlerform_karl_humidifier.yaml
  32. 4 0
      custom_components/tuya_local/devices/wetair_wawh1210lw_humidifier.yaml
  33. 4 0
      custom_components/tuya_local/devices/wilfa_haze_hu400bc_humidifier.yaml
  34. 29 22
      custom_components/tuya_local/humidifier.py
  35. 4 2
      tests/devices/test_eanons_humidifier.py

+ 2 - 1
custom_components/tuya_local/devices/README.md

@@ -570,7 +570,8 @@ Humidifer can also cover dehumidifiers (use class to specify which).
 
 - **switch** (optional, boolean): a dp to control the power state of the fan
 - **mode** (optional, mapping of strings): a dp to control preset modes of the device
-- **humidity** (optional, number):  a dp to control the target humidity of the device
+- **humidity** (optional, number): a dp to control the target humidity of the device
+- **current_humidity** (optional, number): a dp to report the current humidity measured by the device
 
 ### `light`
 - **switch** (optional, boolean): a dp to control the on/off state of the light

+ 4 - 0
custom_components/tuya_local/devices/alecoair_d12_dehumidifier.yaml

@@ -40,6 +40,9 @@ primary_entity:
           value: normal
           icon: "mdi:weather-pouring"
           icon_priority: 3
+    - id: 6
+      name: current_humidity
+      type: integer
     - id: 19
       name: error
       type: bitfield
@@ -72,6 +75,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 6

+ 4 - 0
custom_components/tuya_local/devices/alecoair_d12_home_dehumidifier.yaml

@@ -17,6 +17,9 @@ primary_entity:
           value: boost
         - dps_val: "0"
           value: auto
+    - id: 3
+      name: current_humidity
+      type: integer
     - id: 4
       name: humidity
       type: integer
@@ -36,6 +39,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 3

+ 4 - 0
custom_components/tuya_local/devices/alecoair_d14_dehumidifier.yaml

@@ -39,6 +39,9 @@ primary_entity:
           value: sleep
           icon: "mdi:power-sleep"
           icon_priority: 3
+    - id: 16
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error
@@ -82,6 +85,7 @@ secondary_entities:
         name: switch
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 16

+ 4 - 0
custom_components/tuya_local/devices/alecoair_d16_dehumidifier.yaml

@@ -42,6 +42,9 @@ primary_entity:
           value: sleep
           icon: "mdi:power-sleep"
           icon_priority: 3
+    - id: 16
+      name: current_humidity
+      type: integer
     - id: 19
       name: error
       type: bitfield
@@ -95,6 +98,7 @@ secondary_entities:
         name: switch
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 16

+ 4 - 0
custom_components/tuya_local/devices/blitzwolf_bwsh5_humidifier.yaml

@@ -36,6 +36,9 @@ primary_entity:
         max: 75
       mapping:
         - step: 5
+    - id: 14
+      name: current_humidity
+      type: integer
     - id: 22
       name: unknown_22
       type: integer
@@ -82,6 +85,7 @@ secondary_entities:
           - dps_val: false
             icon: "mdi:led-off"
   - entity: sensor
+    deprecated: humidifier
     name: Current humidity
     class: humidity
     dps:

+ 4 - 0
custom_components/tuya_local/devices/ebac_dj4000_dehumidifier.yaml

@@ -38,6 +38,9 @@ primary_entity:
           value: normal
         - dps_val: boost
           value: boost
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 9
       type: boolean
       name: defrosst
@@ -72,6 +75,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 6

+ 4 - 0
custom_components/tuya_local/devices/eeese_carl_dehumidifier.yaml

@@ -35,6 +35,9 @@ primary_entity:
           icon_priority: 3
         - dps_val: purify
           value: purify
+    - id: 16
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error
@@ -45,6 +48,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 16

+ 4 - 0
custom_components/tuya_local/devices/eeese_otto_dehumidifier.yaml

@@ -35,6 +35,9 @@ primary_entity:
           value: sleep
           icon: "mdi:sleep"
           icon_priority: 3
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error
@@ -45,6 +48,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 6

+ 4 - 0
custom_components/tuya_local/devices/eesee_adam_dehumidifier.yaml

@@ -31,6 +31,9 @@ primary_entity:
           value: boost
           icon: "mdi:tshirt-crew-outline"
           icon_priority: 3
+    - id: 16
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error
@@ -63,6 +66,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 16

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

@@ -37,6 +37,9 @@ primary_entity:
           value: purify
           icon: "mdi:air-purifier"
           icon_priority: 2
+    - id: 6
+      name: current_humidity
+      type: integer
     - id: 19
       name: fault_code
       type: integer
@@ -109,13 +112,13 @@ secondary_entities:
   - entity: sensor
     class: humidity
     name: "Current humidity"
+    deprecated: humidifier
     dps:
       - id: 6
         type: integer
         name: sensor
         unit: "%"
         class: measurement
-        readonly: true
   - entity: switch
     name: Sleep
     category: config

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

@@ -26,7 +26,6 @@ primary_entity:
     - id: 3
       type: integer
       name: current_humidity
-      readonly: true
     - id: 4
       type: integer
       name: humidity
@@ -38,7 +37,6 @@ primary_entity:
     - id: 103
       type: integer
       name: current_temperature
-      readonly: true
 secondary_entities:
   - entity: light
     name: Display
@@ -55,13 +53,13 @@ secondary_entities:
   - entity: sensor
     class: humidity
     name: Current humidity
+    deprecated: humidifier
     dps:
       - id: 3
         type: integer
         name: sensor
         unit: "%"
         class: measurement
-        readonly: true
   - entity: sensor
     class: temperature
     name: Current temperature
@@ -71,4 +69,3 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true

+ 1 - 3
custom_components/tuya_local/devices/electriq_cd12pwv2_dehumidifier.yaml

@@ -34,22 +34,20 @@ primary_entity:
     - id: 6
       type: integer
       name: current_humidity
-      readonly: true
     - id: 19
       type: integer
       name: error_code
-      readonly: true
 secondary_entities:
   - entity: sensor
     class: humidity
     name: Current humidity
+    deprecated: humidifier
     dps:
       - id: 6
         type: integer
         name: sensor
         unit: "%"
         class: measurement
-        readonly: true
   - entity: light
     name: Display
     category: config

+ 1 - 10
custom_components/tuya_local/devices/electriq_cd20pro_dehumidifier.yaml

@@ -32,7 +32,6 @@ primary_entity:
     - id: 3
       type: integer
       name: current_humidity
-      readonly: true
     - id: 4
       type: integer
       name: humidity
@@ -41,13 +40,6 @@ primary_entity:
         max: 80
       mapping:
         - step: 5
-    - id: 5
-      name: anion
-      type: boolean
-    - id: 103
-      type: integer
-      name: current_temperature
-      readonly: true
 secondary_entities:
   - entity: fan
     translation_key: fan_with_presets
@@ -103,13 +95,13 @@ secondary_entities:
   - entity: sensor
     class: humidity
     name: Current humidity
+    deprecated: humidifier
     dps:
       - id: 3
         type: integer
         name: sensor
         unit: "%"
         class: measurement
-        readonly: true
   - entity: sensor
     class: temperature
     name: Current temperature
@@ -119,4 +111,3 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true

+ 1 - 7
custom_components/tuya_local/devices/electriq_cd25pro_dehumidifier.yaml

@@ -33,7 +33,6 @@ primary_entity:
     - id: 3
       type: integer
       name: current_humidity
-      readonly: true
     - id: 4
       type: integer
       name: humidity
@@ -42,10 +41,6 @@ primary_entity:
         max: 80
       mapping:
         - step: 5
-    - id: 103
-      type: integer
-      name: current_temperature
-      readonly: true
 secondary_entities:
   - entity: fan
     translation_key: fan_with_presets
@@ -101,13 +96,13 @@ secondary_entities:
   - entity: sensor
     class: humidity
     name: Current humidity
+    deprecated: humidifier
     dps:
       - id: 3
         type: integer
         name: sensor
         unit: "%"
         class: measurement
-        readonly: true
   - entity: sensor
     class: temperature
     name: Current temperature
@@ -117,4 +112,3 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true

+ 4 - 0
custom_components/tuya_local/devices/electriq_pd45e_dehumidifier.yaml

@@ -18,6 +18,9 @@ primary_entity:
           value: purify
         - dps_val: "3"
           value: laundry
+    - id: 3
+      name: current_humidity
+      type: integer
     - id: 4
       name: humidity
       type: integer
@@ -78,6 +81,7 @@ secondary_entities:
   - entity: sensor
     name: Humidity
     class: humidity
+    deprecated: humidifier
     category: diagnostic
     dps:
       - id: 3

+ 1 - 10
custom_components/tuya_local/devices/goldair_dehumidifier.yaml

@@ -57,19 +57,12 @@ primary_entity:
           icon_priority: 1
         - dps_val: 0
           value: "OK"
-      readonly: true
     - id: 101
       type: boolean
       name: unknown_101
-      readonly: true
-    - id: 103
-      type: integer
-      name: current_temperature
-      readonly: true
     - id: 104
       type: integer
       name: current_humidity
-      readonly: true
     - id: 105
       type: boolean
       name: defrosting
@@ -77,7 +70,6 @@ primary_entity:
         - dps_val: true
           icon: "mdi:snowflake-melt"
           icon_priority: 2
-      readonly: true
 secondary_entities:
   - entity: fan
     dps:
@@ -148,9 +140,9 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 104
@@ -158,7 +150,6 @@ secondary_entities:
         name: sensor
         class: measurement
         unit: "%"
-        readonly: true
   - entity: binary_sensor
     name: Tank
     class: problem

+ 4 - 0
custom_components/tuya_local/devices/goldair_gpdh340_dehumidifier.yaml

@@ -49,6 +49,9 @@ primary_entity:
           icon_priority: 1
         - dps_val: 0
           value: OK
+    - id: 104
+      type: integer
+      name: current_humidity
     - id: 105
       type: integer
       name: model_code
@@ -111,6 +114,7 @@ secondary_entities:
         class: measurement
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 104

+ 1 - 0
custom_components/tuya_local/devices/greenwind_dehumidifier.yaml

@@ -33,6 +33,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 18

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

@@ -44,12 +44,10 @@ primary_entity:
     - id: 18
       name: current_humidity
       type: integer
-    - id: 25
-      name: filter_cleaning_reminder
-      type: boolean
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 18
@@ -57,7 +55,6 @@ secondary_entities:
         name: sensor
         unit: "%"
         class: measurement
-
   - entity: binary_sensor
     name: Filter cleaning reminder
     class: problem

+ 4 - 0
custom_components/tuya_local/devices/hyundai_sahara_dehumidifier.yaml

@@ -24,6 +24,9 @@ primary_entity:
         max: 80
       mapping:
         - step: 5
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 14
       type: boolean
       name: mode
@@ -66,6 +69,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 6

+ 4 - 0
custom_components/tuya_local/devices/inventor_atmospherexl_dehumidifier.yaml

@@ -64,6 +64,9 @@ primary_entity:
           value: laundry
         - dps_val: night
           value: sleep
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error_code
@@ -115,6 +118,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     class: humidity
+    deprecated: humidifier
     name: Room humidity
     dps:
       - id: 6

+ 4 - 0
custom_components/tuya_local/devices/inventor_evaionpro_dehumidifier.yaml

@@ -26,6 +26,9 @@ primary_entity:
           value: auto
         - dps_val: drying
           value: laundry
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: fault_code
@@ -85,6 +88,7 @@ secondary_entities:
   - entity: sensor
     name: Humidity
     class: humidity
+    deprecated: humidifier
     dps:
       - id: 6
         type: integer

+ 4 - 5
custom_components/tuya_local/devices/jjpro_jpd01_dehumidifier.yaml

@@ -53,11 +53,12 @@ primary_entity:
           icon_priority: 1
         - dps_val: 0
           value: "OK"
-      readonly: true
     - id: 101
       type: boolean
       name: unknown_101
-      readonly: true
+    - id: 104
+      type: integer
+      name: current_humidity
     - id: 105
       type: boolean
       name: defrosting
@@ -66,7 +67,6 @@ primary_entity:
         - dps_val: true
           icon: "mdi:snowflake-melt"
           icon_priority: 2
-      readonly: true
 secondary_entities:
   - entity: fan
     dps:
@@ -104,17 +104,16 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true
   - entity: sensor
     name: Current humidity
     class: humidity
+    deprecated: humidifier
     dps:
       - id: 104
         type: integer
         name: sensor
         class: measurement
         unit: "%"
-        readonly: true
   - entity: binary_sensor
     name: Tank
     class: problem

+ 4 - 3
custom_components/tuya_local/devices/jjpro_jpd02_dehumidifier.yaml

@@ -39,6 +39,9 @@ primary_entity:
           value: sleep
           icon: "mdi:weather-night"
           icon_priority: 4
+    - id: 6
+      type: integer
+      name: current_humidity
     - id: 19
       type: bitfield
       name: error
@@ -49,7 +52,6 @@ primary_entity:
           icon_priority: 1
         - dps_val: 0
           value: "OK"
-      readonly: true
 secondary_entities:
   - entity: fan
     dps:
@@ -66,6 +68,7 @@ secondary_entities:
             value: 100
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 6
@@ -73,7 +76,6 @@ secondary_entities:
         name: sensor
         class: measurement
         unit: "%"
-        readonly: true
   - entity: sensor
     name: Current temperature
     class: temperature
@@ -83,7 +85,6 @@ secondary_entities:
         name: sensor
         unit: C
         class: measurement
-        readonly: true
   - entity: lock
     name: Child lock
     category: config

+ 4 - 0
custom_components/tuya_local/devices/klarstein_dryfy_pro_connect_dehumidifier.yaml

@@ -22,6 +22,9 @@ primary_entity:
           value: eco
         - dps_val: fan
           value: purify
+    - id: 3
+      type: integer
+      name: current_humidity
     - id: 4
       type: integer
       name: humidity
@@ -79,6 +82,7 @@ secondary_entities:
             value: "90°"
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 3

+ 4 - 0
custom_components/tuya_local/devices/klarta_humea_humidifier.yaml

@@ -39,6 +39,9 @@ primary_entity:
           value: 70
         - dps_val: "8"
           value: 75
+    - id: 109
+      type: integer
+      name: current_humidity
 secondary_entities:
   - entity: light
     name: Nightlight
@@ -65,6 +68,7 @@ secondary_entities:
         name: switch
   - entity: sensor
     name: Humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 109

+ 1 - 3
custom_components/tuya_local/devices/kogan_dehumidifier.yaml

@@ -33,7 +33,6 @@ primary_entity:
     - id: 11
       name: error
       type: integer
-      readonly: true
       mapping:
         - dps_val: 0
           value: OK
@@ -47,7 +46,6 @@ primary_entity:
     - id: 13
       name: timer
       type: integer
-      readonly: true
     - id: 101
       name: humidity
       type: integer
@@ -78,6 +76,7 @@ secondary_entities:
         type: boolean
   - entity: sensor
     class: humidity
+    deprecated: humidifier
     name: Current humidity
     dps:
       - id: 3
@@ -93,7 +92,6 @@ secondary_entities:
       - id: 11
         name: sensor
         type: integer
-        readonly: true
         mapping:
           - dps_val: 0
             value: false

+ 4 - 0
custom_components/tuya_local/devices/shinco_30d_dehumidifier.yaml

@@ -17,6 +17,9 @@ primary_entity:
           value: auto
         - dps_val: "1"
           value: boost
+    - id: 3
+      type: integer
+      name: current_humidity
     - id: 4
       type: integer
       name: humidity
@@ -42,6 +45,7 @@ secondary_entities:
         name: oscillate
   - entity: sensor
     name: Humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 3

+ 4 - 0
custom_components/tuya_local/devices/stadlerform_eva_humidifier.yaml

@@ -15,6 +15,9 @@ primary_entity:
         max: 80
       mapping:
         - step: 5
+    - id: 14
+      name: current_humidity
+      type: integer
     - id: 22
       name: fault_code
       type: integer
@@ -29,6 +32,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 14

+ 4 - 0
custom_components/tuya_local/devices/stadlerform_karl_humidifier.yaml

@@ -10,6 +10,9 @@ primary_entity:
     - id: 1
       name: switch
       type: boolean
+    - id: 14
+      name: current_humidity
+      type: integer
     - id: 103
       name: humidity
       type: integer
@@ -29,6 +32,7 @@ primary_entity:
 secondary_entities:
   - entity: sensor
     name: Humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 14

+ 4 - 0
custom_components/tuya_local/devices/wetair_wawh1210lw_humidifier.yaml

@@ -17,6 +17,9 @@ primary_entity:
       range:
         min: 30
         max: 80
+    - id: 14
+      name: current_humidity
+      type: integer
     - id: 24
       type: string
       name: mode
@@ -61,6 +64,7 @@ secondary_entities:
 
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 14

+ 4 - 0
custom_components/tuya_local/devices/wilfa_haze_hu400bc_humidifier.yaml

@@ -25,6 +25,9 @@ primary_entity:
           conditions:
             - dps_val: auto
               invalid: true
+    - id: 14
+      type: integer
+      name: current_humidity
     - id: 24
       type: string
       name: mode
@@ -106,6 +109,7 @@ secondary_entities:
             value: F
   - entity: sensor
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     dps:
       - id: 14

+ 29 - 22
custom_components/tuya_local/humidifier.py

@@ -44,13 +44,14 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
         """
         super().__init__()
         dps_map = self._init_begin(device, config)
-        self._humidity_dps = dps_map.pop("humidity", None)
-        self._mode_dps = dps_map.pop("mode", None)
-        self._switch_dps = dps_map.pop("switch", None)
+        self._current_humidity_dp = dps_map.pop("current_humidity", None)
+        self._humidity_dp = dps_map.pop("humidity", None)
+        self._mode_dp = dps_map.pop("mode", None)
+        self._switch_dp = dps_map.pop("switch", None)
         self._init_end(dps_map)
 
         self._support_flags = 0
-        if self._mode_dps:
+        if self._mode_dp:
             self._support_flags |= HumidifierEntityFeature.MODES
 
     @property
@@ -71,63 +72,69 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
     def is_on(self):
         """Return whether the switch is on or not."""
         # If there is no switch, it is always on if available
-        if self._switch_dps is None:
+        if self._switch_dp is None:
             return self.available
-        return self._switch_dps.get_value(self._device)
+        return self._switch_dp.get_value(self._device)
 
     async def async_turn_on(self, **kwargs):
         """Turn the switch on"""
-        await self._switch_dps.async_set_value(self._device, True)
+        await self._switch_dp.async_set_value(self._device, True)
 
     async def async_turn_off(self, **kwargs):
         """Turn the switch off"""
-        await self._switch_dps.async_set_value(self._device, False)
+        await self._switch_dp.async_set_value(self._device, False)
+
+    @property
+    def current_humidity(self):
+        """Return the current humidity if available."""
+        if self._current_humidity_dp:
+            return self._current_humidity_dp.get_value(self._device)
 
     @property
     def target_humidity(self):
         """Return the currently set target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             raise NotImplementedError()
-        return self._humidity_dps.get_value(self._device)
+        return self._humidity_dp.get_value(self._device)
 
     @property
     def min_humidity(self):
         """Return the minimum supported target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             return None
-        r = self._humidity_dps.range(self._device)
+        r = self._humidity_dp.range(self._device)
         return DEFAULT_MIN_HUMIDITY if r is None else r["min"]
 
     @property
     def max_humidity(self):
         """Return the maximum supported target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             return None
-        r = self._humidity_dps.range(self._device)
+        r = self._humidity_dp.range(self._device)
         return DEFAULT_MAX_HUMIDITY if r is None else r["max"]
 
     async def async_set_humidity(self, humidity):
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             raise NotImplementedError()
 
-        await self._humidity_dps.async_set_value(self._device, humidity)
+        await self._humidity_dp.async_set_value(self._device, humidity)
 
     @property
     def mode(self):
         """Return the current preset mode."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             raise NotImplementedError()
-        return self._mode_dps.get_value(self._device)
+        return self._mode_dp.get_value(self._device)
 
     @property
     def available_modes(self):
         """Return the list of presets that this device supports."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             return None
-        return self._mode_dps.values(self._device)
+        return self._mode_dp.values(self._device)
 
     async def async_set_mode(self, mode):
         """Set the preset mode."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             raise NotImplementedError()
-        await self._mode_dps.async_set_value(self._device, mode)
+        await self._mode_dp.async_set_value(self._device, mode)

+ 4 - 2
tests/devices/test_eanons_humidifier.py

@@ -84,6 +84,10 @@ class TestEanonsHumidifier(
         self.dps[HVACMODE_DPS] = False
         self.assertEqual(self.subject.icon, "mdi:air-humidifier-off")
 
+    def test_current_humidity(self):
+        self.dps[CURRENTHUMID_DPS] = 75
+        self.assertEqual(self.subject.current_humidity, 75)
+
     def test_min_target_humidity(self):
         self.assertEqual(self.subject.min_humidity, 40)
 
@@ -159,7 +163,6 @@ class TestEanonsHumidifier(
         self.dps[ERROR_DPS] = 0
         self.dps[TIMERHR_DPS] = "cancel"
         self.dps[TIMER_DPS] = 0
-        self.dps[CURRENTHUMID_DPS] = 50
         self.dps[FANMODE_DPS] = "middle"
 
         self.assertDictEqual(
@@ -168,7 +171,6 @@ class TestEanonsHumidifier(
                 "error": "OK",
                 "timer_hr": "cancel",
                 "timer_min": 0,
-                "current_humidity": 50,
             },
         )