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

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 лет назад
Родитель
Сommit
da8e86691e
35 измененных файлов с 139 добавлено и 75 удалено
  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
 - **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
 - **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`
 ### `light`
 - **switch** (optional, boolean): a dp to control the on/off state of the 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
           value: normal
           icon: "mdi:weather-pouring"
           icon: "mdi:weather-pouring"
           icon_priority: 3
           icon_priority: 3
+    - id: 6
+      name: current_humidity
+      type: integer
     - id: 19
     - id: 19
       name: error
       name: error
       type: bitfield
       type: bitfield
@@ -72,6 +75,7 @@ secondary_entities:
             value: 100
             value: 100
   - entity: sensor
   - entity: sensor
     name: Current humidity
     name: Current humidity
+    deprecated: humidifier
     class: humidity
     class: humidity
     dps:
     dps:
       - id: 6
       - id: 6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 29 - 22
custom_components/tuya_local/humidifier.py

@@ -44,13 +44,14 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
         """
         """
         super().__init__()
         super().__init__()
         dps_map = self._init_begin(device, config)
         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._init_end(dps_map)
 
 
         self._support_flags = 0
         self._support_flags = 0
-        if self._mode_dps:
+        if self._mode_dp:
             self._support_flags |= HumidifierEntityFeature.MODES
             self._support_flags |= HumidifierEntityFeature.MODES
 
 
     @property
     @property
@@ -71,63 +72,69 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
     def is_on(self):
     def is_on(self):
         """Return whether the switch is on or not."""
         """Return whether the switch is on or not."""
         # If there is no switch, it is always on if available
         # 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.available
-        return self._switch_dps.get_value(self._device)
+        return self._switch_dp.get_value(self._device)
 
 
     async def async_turn_on(self, **kwargs):
     async def async_turn_on(self, **kwargs):
         """Turn the switch on"""
         """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):
     async def async_turn_off(self, **kwargs):
         """Turn the switch off"""
         """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
     @property
     def target_humidity(self):
     def target_humidity(self):
         """Return the currently set target humidity."""
         """Return the currently set target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             raise NotImplementedError()
             raise NotImplementedError()
-        return self._humidity_dps.get_value(self._device)
+        return self._humidity_dp.get_value(self._device)
 
 
     @property
     @property
     def min_humidity(self):
     def min_humidity(self):
         """Return the minimum supported target humidity."""
         """Return the minimum supported target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             return 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"]
         return DEFAULT_MIN_HUMIDITY if r is None else r["min"]
 
 
     @property
     @property
     def max_humidity(self):
     def max_humidity(self):
         """Return the maximum supported target humidity."""
         """Return the maximum supported target humidity."""
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             return 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"]
         return DEFAULT_MAX_HUMIDITY if r is None else r["max"]
 
 
     async def async_set_humidity(self, humidity):
     async def async_set_humidity(self, humidity):
-        if self._humidity_dps is None:
+        if self._humidity_dp is None:
             raise NotImplementedError()
             raise NotImplementedError()
 
 
-        await self._humidity_dps.async_set_value(self._device, humidity)
+        await self._humidity_dp.async_set_value(self._device, humidity)
 
 
     @property
     @property
     def mode(self):
     def mode(self):
         """Return the current preset mode."""
         """Return the current preset mode."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             raise NotImplementedError()
             raise NotImplementedError()
-        return self._mode_dps.get_value(self._device)
+        return self._mode_dp.get_value(self._device)
 
 
     @property
     @property
     def available_modes(self):
     def available_modes(self):
         """Return the list of presets that this device supports."""
         """Return the list of presets that this device supports."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             return None
             return None
-        return self._mode_dps.values(self._device)
+        return self._mode_dp.values(self._device)
 
 
     async def async_set_mode(self, mode):
     async def async_set_mode(self, mode):
         """Set the preset mode."""
         """Set the preset mode."""
-        if self._mode_dps is None:
+        if self._mode_dp is None:
             raise NotImplementedError()
             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.dps[HVACMODE_DPS] = False
         self.assertEqual(self.subject.icon, "mdi:air-humidifier-off")
         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):
     def test_min_target_humidity(self):
         self.assertEqual(self.subject.min_humidity, 40)
         self.assertEqual(self.subject.min_humidity, 40)
 
 
@@ -159,7 +163,6 @@ class TestEanonsHumidifier(
         self.dps[ERROR_DPS] = 0
         self.dps[ERROR_DPS] = 0
         self.dps[TIMERHR_DPS] = "cancel"
         self.dps[TIMERHR_DPS] = "cancel"
         self.dps[TIMER_DPS] = 0
         self.dps[TIMER_DPS] = 0
-        self.dps[CURRENTHUMID_DPS] = 50
         self.dps[FANMODE_DPS] = "middle"
         self.dps[FANMODE_DPS] = "middle"
 
 
         self.assertDictEqual(
         self.assertDictEqual(
@@ -168,7 +171,6 @@ class TestEanonsHumidifier(
                 "error": "OK",
                 "error": "OK",
                 "timer_hr": "cancel",
                 "timer_hr": "cancel",
                 "timer_min": 0,
                 "timer_min": 0,
-                "current_humidity": 50,
             },
             },
         )
         )