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

Remove the distinction between primary and secondary entities.

This historical distinction has not mattered for many years now.
It is a source of confusion that primary_entity contained one entity
object and secondary_entities contained a list, making the formats
slightly different, creating a barrier to users making configs.

Combine these into a single `entities` list, and deprecate the old
way.
Jason Rumney 1 год назад
Родитель
Сommit
3506ae3d57
100 измененных файлов с 4095 добавлено и 4209 удалено
  1. 16 18
      custom_components/tuya_local/devices/9in1_airquality_monitor.yaml
  2. 13 14
      custom_components/tuya_local/devices/CT20W_pir_motion_detector.yaml
  3. 26 27
      custom_components/tuya_local/devices/DH-CSK03W_dehumidifier.yaml
  4. 12 13
      custom_components/tuya_local/devices/EM3390TF_weather_station.yaml
  5. 8 9
      custom_components/tuya_local/devices/HCT-626_dual_water_timer.yaml
  6. 29 42
      custom_components/tuya_local/devices/README.md
  7. 14 15
      custom_components/tuya_local/devices/ZC34T-03-3A_swing_arm_opener.yaml
  8. 20 21
      custom_components/tuya_local/devices/abalon_bcm700d_curtain.yaml
  9. 122 123
      custom_components/tuya_local/devices/abir_x8_vacuum.yaml
  10. 68 69
      custom_components/tuya_local/devices/advancedfires_1500_fireplace.yaml
  11. 61 62
      custom_components/tuya_local/devices/aeratron_ae3plus_fan.yaml
  12. 17 18
      custom_components/tuya_local/devices/af3w_petfeeder.yaml
  13. 29 30
      custom_components/tuya_local/devices/afyeev_16a_evcharger.yaml
  14. 34 35
      custom_components/tuya_local/devices/afyeev_evcharger.yaml
  15. 15 16
      custom_components/tuya_local/devices/agl_ultracontato.yaml
  16. 21 22
      custom_components/tuya_local/devices/agl_ultramagic_lock.yaml
  17. 121 122
      custom_components/tuya_local/devices/ailrinni_fingerprint_lock.yaml
  18. 9 10
      custom_components/tuya_local/devices/airquality6in1.yaml
  19. 82 83
      custom_components/tuya_local/devices/airrobo_p20_vacuum.yaml
  20. 23 24
      custom_components/tuya_local/devices/akai_dryer.yaml
  21. 21 22
      custom_components/tuya_local/devices/aktobis_wdh_310ek_dehumidifier.yaml
  22. 28 30
      custom_components/tuya_local/devices/alecoair_d12_dehumidifier.yaml
  23. 30 31
      custom_components/tuya_local/devices/alecoair_d16_dehumidifier.yaml
  24. 29 30
      custom_components/tuya_local/devices/amico_smart_ceiling_fan.yaml
  25. 32 33
      custom_components/tuya_local/devices/andersson_gsh_heater.yaml
  26. 45 46
      custom_components/tuya_local/devices/anko_fan.yaml
  27. 37 38
      custom_components/tuya_local/devices/anko_kettle.yaml
  28. 7 8
      custom_components/tuya_local/devices/aquaforte_vsp_poolpump.yaml
  29. 40 41
      custom_components/tuya_local/devices/aquatech_x6_water_heater.yaml
  30. 6 7
      custom_components/tuya_local/devices/ard100_valve.yaml
  31. 48 49
      custom_components/tuya_local/devices/arlec_12speed_tower_fan.yaml
  32. 26 27
      custom_components/tuya_local/devices/arlec_19speed_fan.yaml
  33. 47 48
      custom_components/tuya_local/devices/arlec_6speed_fan.yaml
  34. 23 24
      custom_components/tuya_local/devices/arlec_apr005ha_air_purifier.yaml
  35. 12 13
      custom_components/tuya_local/devices/arlec_ceiling_fan_remote.yaml
  36. 26 27
      custom_components/tuya_local/devices/arlec_fan.yaml
  37. 24 25
      custom_components/tuya_local/devices/arlec_fan_light.yaml
  38. 92 93
      custom_components/tuya_local/devices/arlec_pa1123bkha_portable_air_conditioner.yaml
  39. 32 33
      custom_components/tuya_local/devices/arlec_panel_heater.yaml
  40. 35 36
      custom_components/tuya_local/devices/arlec_panel_heater_v2.yaml
  41. 10 11
      custom_components/tuya_local/devices/arlec_pb88uha_s2_switch.yaml
  42. 51 52
      custom_components/tuya_local/devices/arlec_rf_transmitter.yaml
  43. 58 59
      custom_components/tuya_local/devices/arlec_rgb_ledstrip.yaml
  44. 14 15
      custom_components/tuya_local/devices/arlec_smart_button.yaml
  45. 91 92
      custom_components/tuya_local/devices/arlec_thermostat_smartplug.yaml
  46. 100 101
      custom_components/tuya_local/devices/asahom_outdoor_rgbcw_lights.yaml
  47. 15 16
      custom_components/tuya_local/devices/asakuki_diffuser.yaml
  48. 6 7
      custom_components/tuya_local/devices/asc_wifi_circuit_breaker.yaml
  49. 8 9
      custom_components/tuya_local/devices/asip_0622_planter.yaml
  50. 34 35
      custom_components/tuya_local/devices/aspen_asp200_fan.yaml
  51. 24 25
      custom_components/tuya_local/devices/atomi_ceiling_fan.yaml
  52. 42 43
      custom_components/tuya_local/devices/atomi_ceramic_heater.yaml
  53. 77 77
      custom_components/tuya_local/devices/atomi_string_lights.yaml
  54. 10 11
      custom_components/tuya_local/devices/atorch_at2pl_breaker.yaml
  55. 7 8
      custom_components/tuya_local/devices/atorch_at4pw_energymeter.yaml
  56. 8 9
      custom_components/tuya_local/devices/atorch_s1wp.yaml
  57. 18 19
      custom_components/tuya_local/devices/aubess_1gang_switch.yaml
  58. 22 23
      custom_components/tuya_local/devices/aubess_2gang_switch.yaml
  59. 7 8
      custom_components/tuya_local/devices/aubess_rainpoint_irrigation_system.yaml
  60. 12 13
      custom_components/tuya_local/devices/aulifants_energymonitor_breaker.yaml
  61. 23 24
      custom_components/tuya_local/devices/avatto_curtain_duallights.yaml
  62. 23 24
      custom_components/tuya_local/devices/avatto_curtain_light.yaml
  63. 14 15
      custom_components/tuya_local/devices/avatto_curtain_switch.yaml
  64. 55 56
      custom_components/tuya_local/devices/avatto_roller_blinds.yaml
  65. 42 43
      custom_components/tuya_local/devices/avatto_trv06_radiatorvalve.yaml
  66. 59 60
      custom_components/tuya_local/devices/avatto_wt100_thermostat.yaml
  67. 20 21
      custom_components/tuya_local/devices/avidsen_soria_solarinverter.yaml
  68. 72 73
      custom_components/tuya_local/devices/awow_th213_thermostat.yaml
  69. 44 45
      custom_components/tuya_local/devices/awow_th213v2_thermostat.yaml
  70. 7 8
      custom_components/tuya_local/devices/axen_ks100w_heatpump.yaml
  71. 77 78
      custom_components/tuya_local/devices/aygrochy_inline_wifi_air_vent.yaml
  72. 50 52
      custom_components/tuya_local/devices/ballu_aura.yaml
  73. 12 12
      custom_components/tuya_local/devices/basic_ir_remote.yaml
  74. 10 11
      custom_components/tuya_local/devices/bauhn_ap5w0624_powerstrip.yaml
  75. 22 23
      custom_components/tuya_local/devices/bcom_intercom_camera.yaml
  76. 56 57
      custom_components/tuya_local/devices/beca_bac002_thermostat_c.yaml
  77. 48 49
      custom_components/tuya_local/devices/beca_bhp6000_thermostat_c.yaml
  78. 48 49
      custom_components/tuya_local/devices/beca_bhp6000_thermostat_f.yaml
  79. 379 380
      custom_components/tuya_local/devices/beca_bhp6000_thermostat_mapped.yaml
  80. 56 57
      custom_components/tuya_local/devices/beca_bht002_thermostat_c.yaml
  81. 83 84
      custom_components/tuya_local/devices/beca_bht006_thermostat_c.yaml
  82. 31 33
      custom_components/tuya_local/devices/beca_zht002_thermostat_c.yaml
  83. 88 89
      custom_components/tuya_local/devices/becool_heatpump.yaml
  84. 30 31
      custom_components/tuya_local/devices/benexmart_blind_motor.yaml
  85. 50 51
      custom_components/tuya_local/devices/beok_tcb38_thermostat.yaml
  86. 61 62
      custom_components/tuya_local/devices/beok_tgm50_thermostat.yaml
  87. 56 57
      custom_components/tuya_local/devices/beok_tgr81_thermostat_c.yaml
  88. 53 54
      custom_components/tuya_local/devices/beok_tol47_thermostat.yaml
  89. 116 117
      custom_components/tuya_local/devices/beok_tr8b_thermostat.yaml
  90. 62 63
      custom_components/tuya_local/devices/beok_tr9b_thermostat.yaml
  91. 37 38
      custom_components/tuya_local/devices/betterlife_bl1500_heater.yaml
  92. 50 51
      custom_components/tuya_local/devices/bht002_galw_thermostat.yaml
  93. 54 55
      custom_components/tuya_local/devices/bht002_gblw_thermostat.yaml
  94. 6 7
      custom_components/tuya_local/devices/ble_adaprox_fingerbot.yaml
  95. 46 47
      custom_components/tuya_local/devices/ble_hct611_watertimer.yaml
  96. 50 51
      custom_components/tuya_local/devices/ble_hu06_lock.yaml
  97. 30 31
      custom_components/tuya_local/devices/ble_orion_lock.yaml
  98. 11 12
      custom_components/tuya_local/devices/ble_pt216_temp_humidity.yaml
  99. 61 62
      custom_components/tuya_local/devices/ble_pulido_p13_lock.yaml
  100. 9 10
      custom_components/tuya_local/devices/ble_smart_plant_moisture.yaml

+ 16 - 18
custom_components/tuya_local/devices/9in1_airquality_monitor.yaml

@@ -3,24 +3,22 @@ products:
   - id: rqhuxgkizawedhxj
     name: ZN-2C09
   - id: rqhuxgkizawedhxj
-primary_entity:
-  entity: sensor
-  name: Air Quality
-  class: enum
-  icon: "mdi:factory"
-  dps:
-    - id: 1
-      type: string
-      name: sensor
-      mapping:
-        - dps_val: "level_1"
-          value: "Excellent"
-        - dps_val: "level_2"
-          value: "Good"
-        - dps_val: level_3
-          value: "Lightly polluted"
-
-secondary_entities:
+entities:
+  - entity: sensor
+    name: Air Quality
+    class: enum
+    icon: "mdi:factory"
+    dps:
+      - id: 1
+        type: string
+        name: sensor
+        mapping:
+          - dps_val: "level_1"
+            value: "Excellent"
+          - dps_val: "level_2"
+            value: "Good"
+          - dps_val: level_3
+            value: "Lightly polluted"
   - entity: sensor
     class: temperature
     dps:

+ 13 - 14
custom_components/tuya_local/devices/CT20W_pir_motion_detector.yaml

@@ -2,20 +2,19 @@ name: Motion detector
 products:
   - id: ejptirvg36uwwdwu
     name: CT20W PIR Motion Detector
-primary_entity:
-  entity: alarm_control_panel
-  dps:
-    - id: 110
-      type: string
-      name: alarm_state
-      mapping:
-        - dps_val: disarm
-          value: disarmed
-        - dps_val: away
-          value: armed_away
-        - dps_val: stay
-          value: armed_home
-secondary_entities:
+entities:
+  - entity: alarm_control_panel
+    dps:
+      - id: 110
+        type: string
+        name: alarm_state
+        mapping:
+          - dps_val: disarm
+            value: disarmed
+          - dps_val: away
+            value: armed_away
+          - dps_val: stay
+            value: armed_home
   - entity: binary_sensor
     class: motion
     dps:

+ 26 - 27
custom_components/tuya_local/devices/DH-CSK03W_dehumidifier.yaml

@@ -1,31 +1,30 @@
 name: "DH-CSK03W Dehumidifier"
-primary_entity:
-  entity: humidifier
-  class: dehumidifier
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: humidity
-      type: integer
-      range:
-        min: 40
-        max: 70
-      mapping:
-        - step: 5
-    - id: 5
-      name: mode
-      type: string
-      mapping:
-        - dps_val: "mode_strong"
-          value: "boost"
-        - dps_val: "mode_sleep"
-          value: "sleep"
-    - id: 6
-      type: integer
-      name: current_humidity
-secondary_entities:
+entities:
+  - entity: humidifier
+    class: dehumidifier
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: humidity
+        type: integer
+        range:
+          min: 40
+          max: 70
+        mapping:
+          - step: 5
+      - id: 5
+        name: mode
+        type: string
+        mapping:
+          - dps_val: "mode_strong"
+            value: "boost"
+          - dps_val: "mode_sleep"
+            value: "sleep"
+      - id: 6
+        type: integer
+        name: current_humidity
   - entity: select
     translation_key: timer
     category: config

+ 12 - 13
custom_components/tuya_local/devices/EM3390TF_weather_station.yaml

@@ -2,19 +2,18 @@ name: Weather station
 products:
   - id: cvurn5ynloebrpwy
     name: Viflykoo EM3390TF
-primary_entity:
-  entity: sensor
-  name: Indoor temperature
-  class: temperature
-  dps:
-    - id: 101
-      type: integer
-      name: sensor
-      class: measurement
-      mapping:
-        - scale: 10
-      unit: C
-secondary_entities:
+entities:
+  - entity: sensor
+    name: Indoor temperature
+    class: temperature
+    dps:
+      - id: 101
+        type: integer
+        name: sensor
+        class: measurement
+        mapping:
+          - scale: 10
+        unit: C
   - entity: sensor
     name: Indoor humidity
     class: humidity

+ 8 - 9
custom_components/tuya_local/devices/HCT-626_dual_water_timer.yaml

@@ -2,15 +2,14 @@ name: Dual water timer
 products:
   - id: smd9kj1n
     name: HCT-626
-primary_entity:
-  entity: valve
-  name: Valve 1
-  class: water
-  dps:
-    - id: 1
-      type: boolean
-      name: valve
-secondary_entities:
+entities:
+  - entity: valve
+    name: Valve 1
+    class: water
+    dps:
+      - id: 1
+        type: boolean
+        name: valve
   - entity: valve
     name: Valve 2
     class: water

+ 29 - 42
custom_components/tuya_local/devices/README.md

@@ -4,8 +4,7 @@ This directory contains device configuration files, describing the workings
 of supported devices. The files are in YAML format, and describe the mapping
 of Tuya DPs (Data Points) to HomeAssistant attributes.
 
-Each Tuya device may correspond to one primary entity and any number of
-secondary entities in Home Assistant.
+Each Tuya device may correspond to one or more entities in Home Assistant.
 
 ## The Top Level
 
@@ -34,37 +33,19 @@ when local discovery is implemented to discover products by id, this name will
 be displayed on discovery, and be available as manufacturer and model info
 in device settings.
 
-### `primary_entity`
+### `entities`
 
-This contains the configuration for one Home Assistant entity which is
-considered the main entity for the device. For example, if the device is
-a heater, this would be a climate entity.
+This contains a list of Home Assistant entities providing the functionality
+of the device.
 
-The configuration for entities is detailed in its own section below.
-
-### `secondary_entities`
-
-*Optional.*
-
-This contains a list of additional Home Assistant entities
-providing additional functionality beyond the capabilities of the primary
-entity. Examples include lighting control for display panels as a Home
-Assistant light entity, child locks as a Home Assistant lock entity,
-or additional toggles as Home Assistant switch entities.
-
-The configuration for secondary entities is the same as primary entities,
-and is detailed in the section below.
+The configuration for each entity in the list is detailed in the section below.
 
 ## Entity configuration
 
 ### `entity`
 
-The Home Assistant entity type being configured. Currently supported
-types are **climate**, **switch**, **light**, **lock**. Functionality
-for these entities is limited to that which has been required for the
-devices until now and may need to be extended for new devices. In
-particular, the light and lock entities have only been used for simple
-secondary entities, so only basic functionality is implemented.
+The Home Assistant entity type being configured. See the **Entity types**
+section below for details on specific requirements for each entity type.
 
 ### `class`
 
@@ -114,23 +95,17 @@ This specifies the `entity category` of the entity. Entities can be categorized
 as `config` or `diagnostic` to restrict where they appear automatically in
 Home Assistant.
 
-### `dps`
-
-This is a list of the definitions for the Tuya DPs associated with
-attributes of this entity. There should be one list entry for each
-supported DPs reported by the device.
-
-The configuration of DPs entries is detailed in its own section below.
-
 ### `name`
 
 *Optional.*
 
-The name associated with this entity can be set here. If no name is set,
-it will inherit the name at the top level. This is mostly useful for
-overriding the name of secondary entities to give more information
-about the purpose of the entity, as the generic type with the top level
-name may not be sufficient to describe the function.
+The name associated with this entity can be set here. If no name is
+set, it will inherit the name at the top level. This is mostly useful
+for overriding the name entities to give more information about the
+purpose of the entity, or to differentiate multiple entities of the
+same type.
+
+Where possible, `translation_key` should be used instead of an explicit name.
 
 ### `mode`
 
@@ -138,7 +113,19 @@ name may not be sufficient to describe the function.
 
 For number entities, this can be used to force `slider` or `box` as the
 input method. The default `auto` uses a slider if the range is small enough,
-or a box otherwise.
+or a box otherwise. It is recommended to let HA decide based on its own logic
+which mode to use, and override it in the UI settings rather than forcing
+your personal preference on others. But if an entity really does only make
+sense with one UI mode, then this is provided to handle those cases.
+
+### `dps`
+
+This is a list of the definitions for the Tuya DPs associated with
+attributes of this entity. There should be one list entry for each
+supported DPs reported by the device.
+
+The configuration of DPs entries is detailed in its own section below.
+
 
 ## DPs configuration
 
@@ -165,9 +152,9 @@ The type of data returned by the Tuya API. Can be one of the following:
 The name given to the attribute in Home Assistant. Certain names are used
 by the Home Assistant entities for specific purposes. If a name is not
 recognized as a standard attribute by the entitiy implementation, the
-attribute will be returned as a readonly custom attribute on the entity.
+attribute will be returned as a readonly extra attribute on the entity.
 If you need non-standard attributes to be able to be set, you will need
-to use a secondary entity for that.
+to use an entity for that (typically switch, number or select).
 
 ### `sensitive`
 

+ 14 - 15
custom_components/tuya_local/devices/ZC34T-03-3A_swing_arm_opener.yaml

@@ -2,21 +2,20 @@ name: Window opener
 products:
   - id: ozttm5n6okadq7tq
     name: ZC34T-03-3A swing arm opener
-primary_entity:
-  entity: cover
-  class: window
-  dps:
-    - id: 101
-      type: string
-      name: control
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-secondary_entities:
+entities:
+  - entity: cover
+    class: window
+    dps:
+      - id: 101
+        type: string
+        name: control
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
   - entity: lock
     dps:
       - id: 102

+ 20 - 21
custom_components/tuya_local/devices/abalon_bcm700d_curtain.yaml

@@ -2,27 +2,26 @@ name: Curtain rail motor
 products:
   - id: XS76BY5Q1uKO6gjC
     name: Abalon BCM700D
-primary_entity:
-  entity: cover
-  class: curtain
-  dps:
-    - id: 101
-      name: position
-      type: integer
-      range:
-        min: 0
-        max: 100
-    - id: 102
-      name: control
-      type: string
-      mapping:
-        - dps_val: ZZ
-          value: open
-        - dps_val: FZ
-          value: close
-        - dps_val: STOP
-          value: stop
-secondary_entities:
+entities:
+  - entity: cover
+    class: curtain
+    dps:
+      - id: 101
+        name: position
+        type: integer
+        range:
+          min: 0
+          max: 100
+      - id: 102
+        name: control
+        type: string
+        mapping:
+          - dps_val: ZZ
+            value: open
+          - dps_val: FZ
+            value: close
+          - dps_val: STOP
+            value: stop
   - entity: switch
     name: Reverse
     category: config

+ 122 - 123
custom_components/tuya_local/devices/abir_x8_vacuum.yaml

@@ -2,129 +2,128 @@ name: Robot vacuum
 products:
   - id: hslyk0g1sim9ojqu
     name: Abir X8
-primary_entity:
-  entity: vacuum
-  dps:
-    - id: 1
-      type: boolean
-      name: power
-    - id: 2
-      type: boolean
-      name: activate
-    - id: 4
-      type: string
-      name: command
-      mapping:
-        - dps_val: smart
-          value: smart
-        - dps_val: zone
-          value: zone
-        - dps_val: pose
-          value: go_to_position
-        - dps_val: part
-          value: clean_spot
-        - dps_val: chargego
-          value: return_to_base
-        - dps_val: wallfollow
-          value: wall_follow
-        - dps_val: selectroom
-          value: select_room
-    - id: 5
-      type: string
-      name: status
-      mapping:
-        - dps_val: standby
-          value: standby
-        - dps_val: smart
-          value: cleaning
-        - dps_val: zone_clean
-          value: cleaning
-        - dps_val: part_clean
-          value: cleaning
-        - dps_val: cleaning
-          value: cleaning
-        - dps_val: paused
-          value: pause
-        - dps_val: goto_pos
-          value: going_to_location
-        - dps_val: pos_arrived
-          value: on_location
-        - dps_val: pos_unarrive
-          value: cannot_find_location
-        - dps_val: goto_charge
-          value: returning
-        - dps_val: charging
-          value: charging
-        - dps_val: charge_done
-          value: charged
-        - dps_val: sleep
-          value: sleep
-        - dps_val: fault
-          value: error
-        - dps_val: wall_follow
-          value: cleaning
-        - dps_val: direction_control
-          value: direction_control
-        - dps_val: select_room
-          value: select_room
-        - dps_val: repositing
-          value: repositioning
-        - dps_val: charge_jack
-          value: charging
-    - id: 9
-      type: string
-      name: fan_speed
-      mapping:
-        - dps_val: strong
-          value: High
-        - dps_val: normal
-          value: Medium
-        - dps_val: gentle
-          value: Low
-    - id: 11
-      type: boolean
-      name: locate
-      optional: true
-    - id: 12
-      type: string
-      name: direction_control
-      optional: true
-      mapping:
-        - dps_val: foward
-          value: forward
-        - dps_val: backward
-          value: reverse
-        - dps_val: turn_left
-          value: left
-        - dps_val: turn_right
-          value: right
-        - dps_val: stop
-          value: stop
-    - id: 14
-      type: string
-      name: path_data
-      optional: true
-    - id: 15
-      type: string
-      name: command_trans
-      optional: true
-    - id: 16
-      type: string
-      name: request
-      optional: true
-    - id: 35
-      type: string
-      name: voice_data
-      optional: true
-    - id: 101
-      type: string
-      name: smart_rooms_unseen
-      optional: true
-    - id: 102
-      type: string
-      name: rooms_msg_unseen
-      optional: true
-secondary_entities:
+entities:
+  - entity: vacuum
+    dps:
+      - id: 1
+        type: boolean
+        name: power
+      - id: 2
+        type: boolean
+        name: activate
+      - id: 4
+        type: string
+        name: command
+        mapping:
+          - dps_val: smart
+            value: smart
+          - dps_val: zone
+            value: zone
+          - dps_val: pose
+            value: go_to_position
+          - dps_val: part
+            value: clean_spot
+          - dps_val: chargego
+            value: return_to_base
+          - dps_val: wallfollow
+            value: wall_follow
+          - dps_val: selectroom
+            value: select_room
+      - id: 5
+        type: string
+        name: status
+        mapping:
+          - dps_val: standby
+            value: standby
+          - dps_val: smart
+            value: cleaning
+          - dps_val: zone_clean
+            value: cleaning
+          - dps_val: part_clean
+            value: cleaning
+          - dps_val: cleaning
+            value: cleaning
+          - dps_val: paused
+            value: pause
+          - dps_val: goto_pos
+            value: going_to_location
+          - dps_val: pos_arrived
+            value: on_location
+          - dps_val: pos_unarrive
+            value: cannot_find_location
+          - dps_val: goto_charge
+            value: returning
+          - dps_val: charging
+            value: charging
+          - dps_val: charge_done
+            value: charged
+          - dps_val: sleep
+            value: sleep
+          - dps_val: fault
+            value: error
+          - dps_val: wall_follow
+            value: cleaning
+          - dps_val: direction_control
+            value: direction_control
+          - dps_val: select_room
+            value: select_room
+          - dps_val: repositing
+            value: repositioning
+          - dps_val: charge_jack
+            value: charging
+      - id: 9
+        type: string
+        name: fan_speed
+        mapping:
+          - dps_val: strong
+            value: High
+          - dps_val: normal
+            value: Medium
+          - dps_val: gentle
+            value: Low
+      - id: 11
+        type: boolean
+        name: locate
+        optional: true
+      - id: 12
+        type: string
+        name: direction_control
+        optional: true
+        mapping:
+          - dps_val: foward
+            value: forward
+          - dps_val: backward
+            value: reverse
+          - dps_val: turn_left
+            value: left
+          - dps_val: turn_right
+            value: right
+          - dps_val: stop
+            value: stop
+      - id: 14
+        type: string
+        name: path_data
+        optional: true
+      - id: 15
+        type: string
+        name: command_trans
+        optional: true
+      - id: 16
+        type: string
+        name: request
+        optional: true
+      - id: 35
+        type: string
+        name: voice_data
+        optional: true
+      - id: 101
+        type: string
+        name: smart_rooms_unseen
+        optional: true
+      - id: 102
+        type: string
+        name: rooms_msg_unseen
+        optional: true
   - entity: switch
     name: Charge
     icon: "mdi:lightning-bolt"

+ 68 - 69
custom_components/tuya_local/devices/advancedfires_1500_fireplace.yaml

@@ -2,75 +2,74 @@ name: Fireplace
 products:
   - id: bf773f569661709b88gzbb
     name: Advanced Fires 1500 electric fireplace
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: heat
-    - id: 2
-      name: temperature
-      type: integer
-      range:
-        min: 16
-        max: 30
-      optional: true
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              value_redirect: temp_set_f
-              range:
-                min: 32
-                max: 104
-    - id: 3
-      name: current_temperature
-      type: integer
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              value_redirect: temp_current_f
-    - id: 5
-      name: fan_mode
-      type: string
-      mapping:
-        - dps_val: "OFF"
-          value: "off"
-        - dps_val: LOW
-          value: low
-        - dps_val: HIGH
-          value: high
-    - id: 19
-      name: temperature_unit
-      type: string
-      mapping:
-        - dps_val: c
-          value: C
-        - dps_val: f
-          value: F
-    - id: 20
-      name: temp_set_f
-      type: integer
-      hidden: true
-      optional: true
-      range:
-        min: 32
-        max: 104
-    - id: 21
-      name: temp_current_f
-      type: integer
-      hidden: true
-    - id: 108
-      name: weekly_schedule
-      type: string
-      optional: true
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: heat
+      - id: 2
+        name: temperature
+        type: integer
+        range:
+          min: 16
+          max: 30
+        optional: true
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                value_redirect: temp_set_f
+                range:
+                  min: 32
+                  max: 104
+      - id: 3
+        name: current_temperature
+        type: integer
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                value_redirect: temp_current_f
+      - id: 5
+        name: fan_mode
+        type: string
+        mapping:
+          - dps_val: "OFF"
+            value: "off"
+          - dps_val: LOW
+            value: low
+          - dps_val: HIGH
+            value: high
+      - id: 19
+        name: temperature_unit
+        type: string
+        mapping:
+          - dps_val: c
+            value: C
+          - dps_val: f
+            value: F
+      - id: 20
+        name: temp_set_f
+        type: integer
+        hidden: true
+        optional: true
+        range:
+          min: 32
+          max: 104
+      - id: 21
+        name: temp_current_f
+        type: integer
+        hidden: true
+      - id: 108
+        name: weekly_schedule
+        type: string
+        optional: true
   - entity: select
     translation_key: temperature_unit
     category: config

+ 61 - 62
custom_components/tuya_local/devices/aeratron_ae3plus_fan.yaml

@@ -2,68 +2,67 @@ name: Ceiling fan
 products:
   - id: iarwcyttkv1kvent
     name: Aeratron AE3+
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 3
-      type: integer
-      # Does not appear to be used from cloud log, so non-standard name used
-      name: fan_speed
-      optional: true
-      range:
-        min: 1
-        max: 100
-    - id: 8
-      type: string
-      optional: true
-      name: direction
-    - id: 101
-      type: string
-      name: speed
-      mapping:
-        - dps_val: "0"
-          value: 1
-          step: 16
-        - dps_val: "1"
-          value: 17
-          step: 16
-        - dps_val: "2"
-          value: 33
-          step: 17
-        - dps_val: "3"
-          value: 50
-          step: 17
-        - dps_val: "4"
-          value: 66
-          step: 17
-        - dps_val: "5"
-          value: 83
-          step: 17
-        - dps_val: "6"
-          value: 100
-          step: 17
-        - value: 0
-          hidden: true
-    - id: 101
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: "0"
-          value: normal
-        - dps_val: "Breeze"
-          value: nature
-        - value: normal
-          hidden: true
-    - id: 103
-      type: integer
-      optional: true
-      name: fan_value
-      # seems to be another unused speed setting with 0-100 range
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 3
+        type: integer
+        # Does not appear to be used from cloud log, so non-standard name used
+        name: fan_speed
+        optional: true
+        range:
+          min: 1
+          max: 100
+      - id: 8
+        type: string
+        optional: true
+        name: direction
+      - id: 101
+        type: string
+        name: speed
+        mapping:
+          - dps_val: "0"
+            value: 1
+            step: 16
+          - dps_val: "1"
+            value: 17
+            step: 16
+          - dps_val: "2"
+            value: 33
+            step: 17
+          - dps_val: "3"
+            value: 50
+            step: 17
+          - dps_val: "4"
+            value: 66
+            step: 17
+          - dps_val: "5"
+            value: 83
+            step: 17
+          - dps_val: "6"
+            value: 100
+            step: 17
+          - value: 0
+            hidden: true
+      - id: 101
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: "0"
+            value: normal
+          - dps_val: "Breeze"
+            value: nature
+          - value: normal
+            hidden: true
+      - id: 103
+        type: integer
+        optional: true
+        name: fan_value
+        # seems to be another unused speed setting with 0-100 range
   # Optional accessory, but there doesn't seem to be a feature flag
   # to automatically disable it
   - entity: light

+ 17 - 18
custom_components/tuya_local/devices/af3w_petfeeder.yaml

@@ -2,24 +2,23 @@ name: Pet feeder
 # products:
 #   - id: UNKNOWN
 #     name: TY-AF3W
-primary_entity:
-  entity: number
-  name: Servings
-  icon: "mdi:chicken-drumstick"
-  dps:
-    - id: 101
-      type: integer
-      optional: true
-      name: value
-      unit: portions
-      range:
-        min: 1
-        max: 10
-    - id: 104
-      type: string
-      optional: true
-      name: schedule
-secondary_entities:
+entities:
+  - entity: number
+    name: Servings
+    icon: "mdi:chicken-drumstick"
+    dps:
+      - id: 101
+        type: integer
+        optional: true
+        name: value
+        unit: portions
+        range:
+          min: 1
+          max: 10
+      - id: 104
+        type: string
+        optional: true
+        name: schedule
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 29 - 30
custom_components/tuya_local/devices/afyeev_16a_evcharger.yaml

@@ -2,36 +2,35 @@ name: EV charger
 products:
   - id: dsmsam7xpb3ht7rl
     name: "Afyeev 16A EV Charger"
-primary_entity:
-  entity: sensor
-  translation_key: status
-  icon: "mdi:ev-station"
-  class: enum
-  dps:
-    - id: 3
-      type: string
-      name: sensor
-      mapping:
-        - dps_val: charger_charging
-          value: charging
-        - dps_val: charger_free
-          value: available
-        - dps_val: charger_insert
-          value: plugged_in
-        - dps_val: charger_free_fault
-          value: fault_unplugged
-        - dps_val: charger_wait
-          value: waiting
-        - dps_val: charger_pause
-          value: paused
-        - dps_val: charger_end
-          value: charged
-        - dps_val: charger_fault
-          value: fault
-    - id: 23
-      type: string
-      name: system_version
-secondary_entities:
+entities:
+  - entity: sensor
+    translation_key: status
+    icon: "mdi:ev-station"
+    class: enum
+    dps:
+      - id: 3
+        type: string
+        name: sensor
+        mapping:
+          - dps_val: charger_charging
+            value: charging
+          - dps_val: charger_free
+            value: available
+          - dps_val: charger_insert
+            value: plugged_in
+          - dps_val: charger_free_fault
+            value: fault_unplugged
+          - dps_val: charger_wait
+            value: waiting
+          - dps_val: charger_pause
+            value: paused
+          - dps_val: charger_end
+            value: charged
+          - dps_val: charger_fault
+            value: fault
+      - id: 23
+        type: string
+        name: system_version
   - entity: sensor
     class: energy
     dps:

+ 34 - 35
custom_components/tuya_local/devices/afyeev_evcharger.yaml

@@ -4,41 +4,40 @@ products:
     name: AFYEEV 32A 22kW
   - id: 65zlpwd6lhgpbwtd
     name: AFYEEV 32A wall mounted
-primary_entity:
-  entity: sensor
-  class: enum
-  translation_key: status
-  icon: "mdi:ev-station"
-  dps:
-    - id: 3
-      type: string
-      name: sensor
-      mapping:
-        - dps_val: charger_free
-          value: available
-        - dps_val: charger_insert
-          value: plugged_in
-        - dps_val: charger_free_fault
-          value: fault_unplugged
-        - dps_val: charger_charging
-          value: charging
-        - dps_val: charger_wait
-          value: waiting
-        - dps_val: charger_end
-          value: charged
-        - dps_val: charger_fault
-          value: fault
-        - dps_val: charger_pause
-          value: paused
-    - id: 23
-      type: string
-      optional: true
-      name: system_version
-    - id: 33
-      type: string
-      optional: true
-      name: mode_set
-secondary_entities:
+entities:
+  - entity: sensor
+    class: enum
+    translation_key: status
+    icon: "mdi:ev-station"
+    dps:
+      - id: 3
+        type: string
+        name: sensor
+        mapping:
+          - dps_val: charger_free
+            value: available
+          - dps_val: charger_insert
+            value: plugged_in
+          - dps_val: charger_free_fault
+            value: fault_unplugged
+          - dps_val: charger_charging
+            value: charging
+          - dps_val: charger_wait
+            value: waiting
+          - dps_val: charger_end
+            value: charged
+          - dps_val: charger_fault
+            value: fault
+          - dps_val: charger_pause
+            value: paused
+      - id: 23
+        type: string
+        optional: true
+        name: system_version
+      - id: 33
+        type: string
+        optional: true
+        name: mode_set
   - entity: sensor
     class: energy
     category: diagnostic

+ 15 - 16
custom_components/tuya_local/devices/agl_ultracontato.yaml

@@ -1,20 +1,19 @@
 name: AGL Ultracontato R2
-primary_entity:
-  entity: cover
-  class: door
-  dps:
-    - id: 1
-      name: control
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "open"
-        - dps_val: false
-          value: "close"
-    - id: 101
-      name: open
-      type: boolean
-secondary_entities:
+entities:
+  - entity: cover
+    class: door
+    dps:
+      - id: 1
+        name: control
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "open"
+          - dps_val: false
+            value: "close"
+      - id: 101
+        name: open
+        type: boolean
   - entity: select
     name: Switch type
     category: config

+ 21 - 22
custom_components/tuya_local/devices/agl_ultramagic_lock.yaml

@@ -2,28 +2,27 @@ name: Gate lock
 products:
   - id: xrqkoapmq1rwjvms
     name: AGL Ultra Magic
-primary_entity:
-  entity: cover
-  class: gate
-  dps:
-    - id: 118
-      type: boolean
-      name: control
-      optional: true
-      mapping:
-        - dps_val: true
-          value: open
-        - dps_val: false
-          value: close
-    - id: 3
-      type: boolean
-      name: action
-      mapping:
-        - dps_val: false
-          value: opened
-        - dps_val: true
-          value: closed
-secondary_entities:
+entities:
+  - entity: cover
+    class: gate
+    dps:
+      - id: 118
+        type: boolean
+        name: control
+        optional: true
+        mapping:
+          - dps_val: true
+            value: open
+          - dps_val: false
+            value: close
+      - id: 3
+        type: boolean
+        name: action
+        mapping:
+          - dps_val: false
+            value: opened
+          - dps_val: true
+            value: closed
   - entity: select
     category: config
     name: Beep

+ 121 - 122
custom_components/tuya_local/devices/ailrinni_fingerprint_lock.yaml

@@ -5,128 +5,127 @@ products:
     name: Ironzon PLD 190
   - id: okkyfgfs
     name: Ailrinni BLE fingerprint lock
-primary_entity:
-  entity: lock
-  dps:
-    - id: 1
-      type: string
-      name: create_unlock_method
-      optional: true
-      sensitive: true
-    - id: 2
-      type: string
-      name: delete_unlock_method
-      optional: true
-    - id: 3
-      type: string
-      name: modify_unlock_method
-      optional: true
-      sensitive: true
-    - id: 6
-      type: string
-      optional: true
-      name: bluetooth_unlock
-    - id: 12
-      type: integer
-      name: unlock_fingerprint
-      optional: true
-      persist: false
-    - id: 13
-      name: unlock_password
-      type: integer
-      optional: true
-      persist: false
-    - id: 14
-      name: unlock_dynamic_pwd
-      type: integer
-      optional: true
-      persist: false
-    - id: 19
-      name: unlock_ble
-      type: integer
-      optional: true
-      persist: false
-    - id: 47  # Lock motor state
-      name: lock
-      type: boolean
-      readonly: true
-      optional: true
-      mapping:
-        - dps_val: true  # Unlocked
-          value: false
-        - dps_val: false  # Locked
-          value: true
-    - id: 51
-      type: string
-      optional: true
-      sensitive: true
-      name: temp_pwd_create
-    - id: 52
-      type: string
-      optional: true
-      name: temp_pwd_delete
-    - id: 53
-      type: string
-      optional: true
-      sensitive: true
-      name: temp_pwd_modify
-    - id: 54
-      type: string
-      optional: true
-      sensitive: true
-      name: sync_method
-    - id: 55
-      type: integer
-      name: unlock_temp_pwd
-      optional: true
-      persist: false
-    - id: 60
-      type: string
-      optional: true
-      sensitive: true
-      name: remote_no_pd_setkey
-    - id: 61
-      type: string
-      optional: true
-      sensitive: true
-      name: remote_no_dp_key
-    - id: 62
-      type: integer
-      name: unlock_app
-      optional: true
-      persist: false
-    - id: 63
-      name: unlock_voice
-      type: integer
-      optional: true
-      persist: false
-    - id: 64
-      type: string
-      optional: true
-      name: pwd_offline_time
-    - id: 65
-      type: string
-      optional: true
-      name: offline_pwd_cleared
-    - id: 66
-      type: string
-      optional: true
-      name: offline_pwd_clear_all
-    - id: 67
-      type: string
-      optional: true
-      persist: false
-      name: unlock_offline_pwd
-      mapping:
-        - dps_val: null
-          value: null
-        - value: 1
-    - id: 67
-      type: string
-      optional: true
-      sensitive: true
-      name: offline_pwd_details
-secondary_entities:
+entities:
+  - entity: lock
+    dps:
+      - id: 1
+        type: string
+        name: create_unlock_method
+        optional: true
+        sensitive: true
+      - id: 2
+        type: string
+        name: delete_unlock_method
+        optional: true
+      - id: 3
+        type: string
+        name: modify_unlock_method
+        optional: true
+        sensitive: true
+      - id: 6
+        type: string
+        optional: true
+        name: bluetooth_unlock
+      - id: 12
+        type: integer
+        name: unlock_fingerprint
+        optional: true
+        persist: false
+      - id: 13
+        name: unlock_password
+        type: integer
+        optional: true
+        persist: false
+      - id: 14
+        name: unlock_dynamic_pwd
+        type: integer
+        optional: true
+        persist: false
+      - id: 19
+        name: unlock_ble
+        type: integer
+        optional: true
+        persist: false
+      - id: 47  # Lock motor state
+        name: lock
+        type: boolean
+        readonly: true
+        optional: true
+        mapping:
+          - dps_val: true  # Unlocked
+            value: false
+          - dps_val: false  # Locked
+            value: true
+      - id: 51
+        type: string
+        optional: true
+        sensitive: true
+        name: temp_pwd_create
+      - id: 52
+        type: string
+        optional: true
+        name: temp_pwd_delete
+      - id: 53
+        type: string
+        optional: true
+        sensitive: true
+        name: temp_pwd_modify
+      - id: 54
+        type: string
+        optional: true
+        sensitive: true
+        name: sync_method
+      - id: 55
+        type: integer
+        name: unlock_temp_pwd
+        optional: true
+        persist: false
+      - id: 60
+        type: string
+        optional: true
+        sensitive: true
+        name: remote_no_pd_setkey
+      - id: 61
+        type: string
+        optional: true
+        sensitive: true
+        name: remote_no_dp_key
+      - id: 62
+        type: integer
+        name: unlock_app
+        optional: true
+        persist: false
+      - id: 63
+        name: unlock_voice
+        type: integer
+        optional: true
+        persist: false
+      - id: 64
+        type: string
+        optional: true
+        name: pwd_offline_time
+      - id: 65
+        type: string
+        optional: true
+        name: offline_pwd_cleared
+      - id: 66
+        type: string
+        optional: true
+        name: offline_pwd_clear_all
+      - id: 67
+        type: string
+        optional: true
+        persist: false
+        name: unlock_offline_pwd
+        mapping:
+          - dps_val: null
+            value: null
+          - value: 1
+      - id: 67
+        type: string
+        optional: true
+        sensitive: true
+        name: offline_pwd_details
   - entity: sensor
     class: battery
     dps:

+ 9 - 10
custom_components/tuya_local/devices/airquality6in1.yaml

@@ -2,16 +2,15 @@ name: Air quality monitor
 products:
   - id: ugjbnqj2mffaexp5
     name: Air Housekeeper 6-in-1
-primary_entity:
-  entity: sensor
-  class: pm25
-  dps:
-    - id: 2
-      type: integer
-      name: sensor
-      unit: µg/m³
-      class: measurement
-secondary_entities:
+entities:
+  - entity: sensor
+    class: pm25
+    dps:
+      - id: 2
+        type: integer
+        name: sensor
+        unit: µg/m³
+        class: measurement
   - entity: sensor
     class: temperature
     dps:

+ 82 - 83
custom_components/tuya_local/devices/airrobo_p20_vacuum.yaml

@@ -2,89 +2,88 @@ name: Robot vacuum
 # products:
 #  - id: UNKNOWN
 #    name: Airrobo P20
-primary_entity:
-  entity: vacuum
-  dps:
-    - id: 2
-      type: boolean
-      name: activate
-      optional: true
-    - id: 3
-      type: string
-      name: command
-      mapping:
-        - dps_val: standby
-          value: standby
-        - dps_val: smart
-          value: smart
-        - dps_val: wall_follow
-          value: wall_follow
-        - dps_val: spiral
-          value: clean_spot
-        - dps_val: partial_bow
-          value: partial_bow
-        - dps_val: chargego
-          value: return_to_base
-    - id: 4
-      type: string
-      name: direction_control
-      mapping:
-        - dps_val: forward
-          value: forward
-        - dps_val: turn_left
-          value: left
-        - dps_val: turn_right
-          value: right
-        - dps_val: stop
-          value: stop
-    - id: 5
-      type: string
-      name: status
-      mapping:
-        - dps_val: standby
-          value: idle
-        - dps_val: smart_clean
-          value: cleaning
-        - dps_val: wall_clean
-          value: cleaning
-        - dps_val: spot_clean
-          value: cleaning
-        - dps_val: mop_clean
-          value: cleaning
-        - dps_val: goto_charge
-          value: returning
-        - dps_val: charging
-          value: charging
-        - dps_val: charge_done
-          value: docked
-        - dps_val: paused
-          value: paused
-        - dps_val: cleaning
-          value: cleaning
-        - dps_val: sleep
-          value: idle
-    - id: 13
-      type: boolean
-      name: locate
-      optional: true
-    - id: 14
-      type: string
-      name: fan_speed
-      mapping:
-        - dps_val: gentle
-          value: Silent
-        - dps_val: normal
-          value: Normal
-        - dps_val: strong
-          value: Strong
-    - id: 18
-      type: bitfield
-      name: error
-      optional: true
-    - id: 104
-      type: string
-      name: serial_number
-secondary_entities:
+entities:
+  - entity: vacuum
+    dps:
+      - id: 2
+        type: boolean
+        name: activate
+        optional: true
+      - id: 3
+        type: string
+        name: command
+        mapping:
+          - dps_val: standby
+            value: standby
+          - dps_val: smart
+            value: smart
+          - dps_val: wall_follow
+            value: wall_follow
+          - dps_val: spiral
+            value: clean_spot
+          - dps_val: partial_bow
+            value: partial_bow
+          - dps_val: chargego
+            value: return_to_base
+      - id: 4
+        type: string
+        name: direction_control
+        mapping:
+          - dps_val: forward
+            value: forward
+          - dps_val: turn_left
+            value: left
+          - dps_val: turn_right
+            value: right
+          - dps_val: stop
+            value: stop
+      - id: 5
+        type: string
+        name: status
+        mapping:
+          - dps_val: standby
+            value: idle
+          - dps_val: smart_clean
+            value: cleaning
+          - dps_val: wall_clean
+            value: cleaning
+          - dps_val: spot_clean
+            value: cleaning
+          - dps_val: mop_clean
+            value: cleaning
+          - dps_val: goto_charge
+            value: returning
+          - dps_val: charging
+            value: charging
+          - dps_val: charge_done
+            value: docked
+          - dps_val: paused
+            value: paused
+          - dps_val: cleaning
+            value: cleaning
+          - dps_val: sleep
+            value: idle
+      - id: 13
+        type: boolean
+        name: locate
+        optional: true
+      - id: 14
+        type: string
+        name: fan_speed
+        mapping:
+          - dps_val: gentle
+            value: Silent
+          - dps_val: normal
+            value: Normal
+          - dps_val: strong
+            value: Strong
+      - id: 18
+        type: bitfield
+        name: error
+        optional: true
+      - id: 104
+        type: string
+        name: serial_number
   - entity: sensor
     class: battery
     dps:

+ 23 - 24
custom_components/tuya_local/devices/akai_dryer.yaml

@@ -2,30 +2,29 @@ name: Dryer
 products:
   - id: do3cbzmmdqfdpqxw
     name: Akai heat pump dryer
-primary_entity:
-  entity: sensor
-  class: enum
-  icon: "mdi:tumble-dryer"
-  dps:
-    - id: 107
-      name: sensor
-      type: string
-      mapping:
-        - dps_val: "off"
-          value: "off"
-        - dps_val: "set"
-          value: "set"
-        - dps_val: "run"
-          value: "run"
-        - dps_val: "pause"
-          value: "pause"
-        - dps_val: "delay"
-          value: "delay"
-        - dps_val: "end"
-          value: "end"
-        - dps_val: "err"
-          value: "error"
-secondary_entities:
+entities:
+  - entity: sensor
+    class: enum
+    icon: "mdi:tumble-dryer"
+    dps:
+      - id: 107
+        name: sensor
+        type: string
+        mapping:
+          - dps_val: "off"
+            value: "off"
+          - dps_val: "set"
+            value: "set"
+          - dps_val: "run"
+            value: "run"
+          - dps_val: "pause"
+            value: "pause"
+          - dps_val: "delay"
+            value: "delay"
+          - dps_val: "end"
+            value: "end"
+          - dps_val: "err"
+            value: "error"
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 21 - 22
custom_components/tuya_local/devices/aktobis_wdh_310ek_dehumidifier.yaml

@@ -2,28 +2,27 @@ name: Dehumidifier
 products:
   - id: ifasqsxbghku3bwk
     name: Aktobis WDH-310EKW dehumidifier
-primary_entity:
-  entity: humidifier
-  class: dehumidifier
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-      mapping:
-        - dps_val: false
-        - dps_val: true
-    - id: 3
-      name: humidity
-      type: integer
-      range:
-        min: 30
-        max: 70
-      mapping:
-        - step: 5
-    - id: 6
-      name: current_humidity
-      type: integer
-secondary_entities:
+entities:
+  - entity: humidifier
+    class: dehumidifier
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+        mapping:
+          - dps_val: false
+          - dps_val: true
+      - id: 3
+        name: humidity
+        type: integer
+        range:
+          min: 30
+          max: 70
+        mapping:
+          - step: 5
+      - id: 6
+        name: current_humidity
+        type: integer
   - entity: fan
     dps:
       - id: 1

+ 28 - 30
custom_components/tuya_local/devices/alecoair_d12_dehumidifier.yaml

@@ -2,36 +2,34 @@ name: AlecoAir D12 ECO dehumidifier
 products:
   - id: gcthce4ejb8nzgow
     name: D12 ECO 2.0
-primary_entity:
-  entity: humidifier
-  class: dehumidifier
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: humidity
-      type: integer
-      range:
-        min: 20
-        max: 95
-      mapping:
-        - step: 5
-    - id: 5
-      name: mode
-      type: string
-      mapping:
-        - dps_val: Continuous
-          value: boost
-        - dps_val: Sunny_Day
-          value: eco
-        - dps_val: Rain_Day
-          value: normal
-
-    - id: 6
-      name: current_humidity
-      type: integer
-secondary_entities:
+entities:
+  - entity: humidifier
+    class: dehumidifier
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: humidity
+        type: integer
+        range:
+          min: 20
+          max: 95
+        mapping:
+          - step: 5
+      - id: 5
+        name: mode
+        type: string
+        mapping:
+          - dps_val: Continuous
+            value: boost
+          - dps_val: Sunny_Day
+            value: eco
+          - dps_val: Rain_Day
+            value: normal
+      - id: 6
+        name: current_humidity
+        type: integer
   - entity: fan
     dps:
       - id: 1

+ 30 - 31
custom_components/tuya_local/devices/alecoair_d16_dehumidifier.yaml

@@ -3,37 +3,36 @@ legacy_type: alecoair_d14_dehumidifier
 products:
   - id: pzq25786mlkxmtbb
     name: AlecoAir D16 Purify
-primary_entity:
-  entity: humidifier
-  class: dehumidifier
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: humidity
-      type: integer
-      range:
-        min: 25
-        max: 80
-      mapping:
-        - step: 5
-    - id: 4
-      name: mode
-      type: string
-      mapping:
-        - dps_val: manual
-          value: normal
-        - dps_val: laundry
-          value: laundry
-        - dps_val: purify
-          value: purify
-        - dps_val: sleep
-          value: sleep
-    - id: 16
-      name: current_humidity
-      type: integer
-secondary_entities:
+entities:
+  - entity: humidifier
+    class: dehumidifier
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: humidity
+        type: integer
+        range:
+          min: 25
+          max: 80
+        mapping:
+          - step: 5
+      - id: 4
+        name: mode
+        type: string
+        mapping:
+          - dps_val: manual
+            value: normal
+          - dps_val: laundry
+            value: laundry
+          - dps_val: purify
+            value: purify
+          - dps_val: sleep
+            value: sleep
+      - id: 16
+        name: current_humidity
+        type: integer
   - entity: fan
     dps:
       - id: 1

+ 29 - 30
custom_components/tuya_local/devices/amico_smart_ceiling_fan.yaml

@@ -2,36 +2,35 @@ name: Ceiling fan
 products:
   - id: eb208a14315d7cb2bd6txt
     name: Amico 52 inch ceiling fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 60
-      type: boolean
-      name: switch
-    - id: 61
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: fresh
-          value: fresh
-        - dps_val: nature
-          value: nature
-    - id: 62
-      type: integer
-      name: speed
-      range:
-        min: 1
-        max: 6
-    - id: 63
-      type: string
-      name: direction
-      mapping:
-        - dps_val: forward
-          value: forward
-        - dps_val: reverse
-          value: reverse
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 60
+        type: boolean
+        name: switch
+      - id: 61
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: fresh
+            value: fresh
+          - dps_val: nature
+            value: nature
+      - id: 62
+        type: integer
+        name: speed
+        range:
+          min: 1
+          max: 6
+      - id: 63
+        type: string
+        name: direction
+        mapping:
+          - dps_val: forward
+            value: forward
+          - dps_val: reverse
+            value: reverse
   - entity: light
     dps:
       - id: 20

+ 32 - 33
custom_components/tuya_local/devices/andersson_gsh_heater.yaml

@@ -5,39 +5,38 @@ products:
   #   name: Andersson GSH
   - id: qAmsenZuNF74vRvj
     name: Devola Intelligent
-primary_entity:
-  entity: climate
-  translation_only_key: heater
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "heat"
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 35
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: low
-          value: eco
-        - dps_val: high
-          value: boost
-        - dps_val: af
-          value: away
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: heater
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "heat"
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 35
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: low
+            value: eco
+          - dps_val: high
+            value: boost
+          - dps_val: af
+            value: away
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 45 - 46
custom_components/tuya_local/devices/anko_fan.yaml

@@ -1,50 +1,49 @@
 name: Anko fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 2
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: normal
-          value: normal
-        - dps_val: nature
-          value: nature
-        - dps_val: sleep
-          value: sleep
-    - id: 3
-      type: string
-      name: speed
-      mapping:
-        - dps_val: "1"
-          value: 13
-        - dps_val: "2"
-          value: 25
-        - dps_val: "3"
-          value: 37
-        - dps_val: "4"
-          value: 50
-        - dps_val: "5"
-          value: 63
-        - dps_val: "6"
-          value: 75
-        - dps_val: "7"
-          value: 87
-        - dps_val: "8"
-          value: 100
-    - id: 4
-      type: string
-      name: oscillate
-      mapping:
-        - dps_val: "auto"
-          value: true
-        - dps_val: "off"
-          value: false
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 2
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: normal
+            value: normal
+          - dps_val: nature
+            value: nature
+          - dps_val: sleep
+            value: sleep
+      - id: 3
+        type: string
+        name: speed
+        mapping:
+          - dps_val: "1"
+            value: 13
+          - dps_val: "2"
+            value: 25
+          - dps_val: "3"
+            value: 37
+          - dps_val: "4"
+            value: 50
+          - dps_val: "5"
+            value: 63
+          - dps_val: "6"
+            value: 75
+          - dps_val: "7"
+            value: 87
+          - dps_val: "8"
+            value: 100
+      - id: 4
+        type: string
+        name: oscillate
+        mapping:
+          - dps_val: "auto"
+            value: true
+          - dps_val: "off"
+            value: false
   - entity: number
     translation_key: timer
     class: duration

+ 37 - 38
custom_components/tuya_local/devices/anko_kettle.yaml

@@ -2,44 +2,43 @@ name: Anko kettle
 products:
   - id: dft4ebatvon3ha5s
     name: Anko LD-K3068
-primary_entity:
-  entity: water_heater
-  icon: "mdi:kettle"
-  dps:
-    - id: 1
-      type: boolean
-      name: operation_mode
-      mapping:
-        - dps_val: false
-          value: "Off"
-        - dps_val: true
-          constraint: work_type
-          conditions:
-            - dps_val: boiling_quick
-              value: Quick boil
-            - dps_val: setting_quick
-              value: Quick heat
-            - dps_val: temp_boiling
-              value: Boil
-            - dps_val: temp_setting
-              value: Heat
-    - id: 2
-      type: integer
-      name: current_temperature
-      unit: C
-    - id: 4
-      type: integer
-      name: temperature
-      range:
-        min: 85
-        max: 90
-      mapping:
-        - step: 5
-    - id: 16
-      type: string
-      name: work_type
-      hidden: true
-secondary_entities:
+entities:
+  - entity: water_heater
+    icon: "mdi:kettle"
+    dps:
+      - id: 1
+        type: boolean
+        name: operation_mode
+        mapping:
+          - dps_val: false
+            value: "Off"
+          - dps_val: true
+            constraint: work_type
+            conditions:
+              - dps_val: boiling_quick
+                value: Quick boil
+              - dps_val: setting_quick
+                value: Quick heat
+              - dps_val: temp_boiling
+                value: Boil
+              - dps_val: temp_setting
+                value: Heat
+      - id: 2
+        type: integer
+        name: current_temperature
+        unit: C
+      - id: 4
+        type: integer
+        name: temperature
+        range:
+          min: 85
+          max: 90
+        mapping:
+          - step: 5
+      - id: 16
+        type: string
+        name: work_type
+        hidden: true
   - entity: switch
     name: Keep warm
     icon: "mdi:kettle-outline"

+ 7 - 8
custom_components/tuya_local/devices/aquaforte_vsp_poolpump.yaml

@@ -2,14 +2,13 @@ name: Pool pump
 products:
   - id: i0elff0w1pehctax
     name: AquaForte Inverter VSP
-primary_entity:
-  entity: valve
-  class: water
-  dps:
-    - id: 105
-      type: boolean
-      name: valve
-secondary_entities:
+entities:
+  - entity: valve
+    class: water
+    dps:
+      - id: 105
+        type: boolean
+        name: valve
   - entity: select
     name: Pump mode
     icon: "mdi:pump"

+ 40 - 41
custom_components/tuya_local/devices/aquatech_x6_water_heater.yaml

@@ -1,45 +1,44 @@
 name: Aquatech RAPID/X6
-primary_entity:
-  entity: water_heater
-  dps:
-    - id: 1
-      type: boolean
-      name: operation_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: work_mode
-          conditions:
-            - dps_val: ECO
-              value: eco
-            - dps_val: Stand
-              value: heat_pump
-            - dps_val: HYB
-              value: high_demand
-            - dps_val: HYB1
-              value: performance
-            - dps_val: ELE
-              value: electric
-    - id: 2
-      type: string
-      name: work_mode
-      hidden: true
-    - id: 4
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 15
-        max: 75
-      readonly: true
-    - id: 7
-      type: boolean
-      name: defrosting
-    - id: 16
-      type: integer
-      name: current_temperature
-secondary_entities:
+entities:
+  - entity: water_heater
+    dps:
+      - id: 1
+        type: boolean
+        name: operation_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: work_mode
+            conditions:
+              - dps_val: ECO
+                value: eco
+              - dps_val: Stand
+                value: heat_pump
+              - dps_val: HYB
+                value: high_demand
+              - dps_val: HYB1
+                value: performance
+              - dps_val: ELE
+                value: electric
+      - id: 2
+        type: string
+        name: work_mode
+        hidden: true
+      - id: 4
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 15
+          max: 75
+        readonly: true
+      - id: 7
+        type: boolean
+        name: defrosting
+      - id: 16
+        type: integer
+        name: current_temperature
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 6 - 7
custom_components/tuya_local/devices/ard100_valve.yaml

@@ -2,13 +2,12 @@ name: Valve controller
 products:
   - id: nguto5atyd2xxnap
     name: ARD-100+ smart valve controller
-primary_entity:
-  entity: valve
-  dps:
-    - id: 1
-      type: boolean
-      name: valve
-secondary_entities:
+entities:
+  - entity: valve
+    dps:
+      - id: 1
+        type: boolean
+        name: valve
   - entity: switch
     icon: "mdi:valve"
     deprecated: valve

+ 48 - 49
custom_components/tuya_local/devices/arlec_12speed_tower_fan.yaml

@@ -1,55 +1,54 @@
 name: Arlec tower fan
 products:
   - id: rklgm99ldz4unh5s
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: normal
-          value: normal
-        - dps_val: nature
-          value: nature
-        - dps_val: sleep
-          value: sleep
-    - id: 3
-      name: speed
-      type: string
-      mapping:
-        - dps_val: "1"
-          value: 8
-        - dps_val: "2"
-          value: 17
-        - dps_val: "3"
-          value: 25
-        - dps_val: "4"
-          value: 33
-        - dps_val: "5"
-          value: 42
-        - dps_val: "6"
-          value: 50
-        - dps_val: "7"
-          value: 58
-        - dps_val: "8"
-          value: 67
-        - dps_val: "9"
-          value: 75
-        - dps_val: "10"
-          value: 83
-        - dps_val: "11"
-          value: 92
-        - dps_val: "12"
-          value: 100
-    - id: 102
-      name: oscillate
-      type: boolean
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: normal
+            value: normal
+          - dps_val: nature
+            value: nature
+          - dps_val: sleep
+            value: sleep
+      - id: 3
+        name: speed
+        type: string
+        mapping:
+          - dps_val: "1"
+            value: 8
+          - dps_val: "2"
+            value: 17
+          - dps_val: "3"
+            value: 25
+          - dps_val: "4"
+            value: 33
+          - dps_val: "5"
+            value: 42
+          - dps_val: "6"
+            value: 50
+          - dps_val: "7"
+            value: 58
+          - dps_val: "8"
+            value: 67
+          - dps_val: "9"
+            value: 75
+          - dps_val: "10"
+            value: 83
+          - dps_val: "11"
+            value: 92
+          - dps_val: "12"
+            value: 100
+      - id: 102
+        name: oscillate
+        type: boolean
   - entity: select
     translation_key: timer
     category: config

+ 26 - 27
custom_components/tuya_local/devices/arlec_19speed_fan.yaml

@@ -2,33 +2,32 @@ name: Arlec industrial fan
 products:
   - id: 0waab4clioc3qaks
     name: Arlec 19-speed industrial wall fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: normal
-          value: normal
-        - dps_val: sleep
-          value: sleep
-        - dps_val: natural
-          value: nature
-    - id: 3
-      name: speed
-      type: integer
-      range:
-        min: 1
-        max: 19
-    - id: 5
-      name: oscillate
-      type: boolean
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: normal
+            value: normal
+          - dps_val: sleep
+            value: sleep
+          - dps_val: natural
+            value: nature
+      - id: 3
+        name: speed
+        type: integer
+        range:
+          min: 1
+          max: 19
+      - id: 5
+        name: oscillate
+        type: boolean
   - entity: number
     translation_key: timer
     class: duration

+ 47 - 48
custom_components/tuya_local/devices/arlec_6speed_fan.yaml

@@ -2,54 +2,53 @@ name: Arlec floor fan
 products:
   - id: tsgf7ywzeit2d90b
     name: Arlec 45cm black floor fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 2
-      name: preset_mode
-      type: string
-      optional: true
-      mapping:
-        - dps_val: nature
-          value: nature
-        - dps_val: sleep
-          value: sleep
-        - dps_val: fresh
-          value: fresh
-        - dps_val: smart
-          value: smart
-        - dps_val: strong
-          value: strong
-        - dps_val: closed
-          value: "off"
-        - dps_val: ordinary
-          value: normal
-        - dps_val: null
-          value: "off"
-    - id: 3
-      name: speed
-      type: string
-      mapping:
-        - dps_val: "1"
-          value: 17
-        - dps_val: "2"
-          value: 33
-        - dps_val: "3"
-          value: 50
-        - dps_val: "4"
-          value: 67
-        - dps_val: "5"
-          value: 83
-        - dps_val: "6"
-          value: 100
-    - id: 101
-      type: boolean
-      name: oscillate
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 2
+        name: preset_mode
+        type: string
+        optional: true
+        mapping:
+          - dps_val: nature
+            value: nature
+          - dps_val: sleep
+            value: sleep
+          - dps_val: fresh
+            value: fresh
+          - dps_val: smart
+            value: smart
+          - dps_val: strong
+            value: strong
+          - dps_val: closed
+            value: "off"
+          - dps_val: ordinary
+            value: normal
+          - dps_val: null
+            value: "off"
+      - id: 3
+        name: speed
+        type: string
+        mapping:
+          - dps_val: "1"
+            value: 17
+          - dps_val: "2"
+            value: 33
+          - dps_val: "3"
+            value: 50
+          - dps_val: "4"
+            value: 67
+          - dps_val: "5"
+            value: 83
+          - dps_val: "6"
+            value: 100
+      - id: 101
+        type: boolean
+        name: oscillate
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 23 - 24
custom_components/tuya_local/devices/arlec_apr005ha_air_purifier.yaml

@@ -2,30 +2,29 @@ name: Air Purifier
 products:
   - id: dfgsetrdnabqeimr
     name: Arlec Air Purifier APR005HA
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 3
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: Auto
-          value: smart
-        - dps_val: Manual
-          value: normal
-        - dps_val: Sleep
-          value: sleep
-    - id: 4
-      type: integer
-      name: speed
-      range:
-        min: 1
-        max: 3
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 3
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: Auto
+            value: smart
+          - dps_val: Manual
+            value: normal
+          - dps_val: Sleep
+            value: sleep
+      - id: 4
+        type: integer
+        name: speed
+        range:
+          min: 1
+          max: 3
   - entity: switch
     translation_key: ionizer
     category: config

+ 12 - 13
custom_components/tuya_local/devices/arlec_ceiling_fan_remote.yaml

@@ -5,19 +5,18 @@ products:
     name: Sulion Cadillac Fan Controller
   - id: b8bofb3ruee9zwxc
     name: Arlec AC Fan Controller CFR225HA
-primary_entity:
-  entity: fan
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 3
-      type: integer
-      name: speed
-      range:
-        min: 1
-        max: 3
-secondary_entities:
+entities:
+  - entity: fan
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 3
+        type: integer
+        name: speed
+        range:
+          min: 1
+          max: 3
   - entity: light
     dps:
       - id: 15

+ 26 - 27
custom_components/tuya_local/devices/arlec_fan.yaml

@@ -1,31 +1,30 @@
 name: ARLEC Grid Connect Fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 3
-      name: speed
-      type: integer
-      range:
-        min: 1
-        max: 6
-    - id: 4
-      name: direction
-      type: string
-    - id: 102
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: normal
-          value: normal
-        - dps_val: sleep
-          value: sleep
-        - dps_val: breeze
-          value: nature
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 3
+        name: speed
+        type: integer
+        range:
+          min: 1
+          max: 6
+      - id: 4
+        name: direction
+        type: string
+      - id: 102
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: normal
+            value: normal
+          - dps_val: sleep
+            value: sleep
+          - dps_val: breeze
+            value: nature
   - entity: select
     translation_key: timer
     category: config

+ 24 - 25
custom_components/tuya_local/devices/arlec_fan_light.yaml

@@ -1,29 +1,28 @@
 name: ARLEC fan with light
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 3
-      name: speed
-      type: integer
-      range:
-        min: 1
-        max: 6
-    - id: 4
-      name: direction
-      type: string
-    - id: 102
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: nature
-          value: nature
-        - dps_val: sleep
-          value: sleep
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 3
+        name: speed
+        type: integer
+        range:
+          min: 1
+          max: 6
+      - id: 4
+        name: direction
+        type: string
+      - id: 102
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: nature
+            value: nature
+          - dps_val: sleep
+            value: sleep
   - entity: light
     dps:
       - id: 9

+ 92 - 93
custom_components/tuya_local/devices/arlec_pa1123bkha_portable_air_conditioner.yaml

@@ -2,99 +2,98 @@ name: Portable air conditioner
 products:
   - id: fxy4qkdh62geizbw
     name: Arlec PA1123BKHA portable air conditioner
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: "1"
-              value: cool
-            - dps_val: "2"
-              value: heat
-            - dps_val: "3"
-              value: dry
-            - dps_val: "4"
-              value: fan_only
-    - id: 2
-      type: integer
-      name: temperature
-      range:
-        min: 16
-        max: 31
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: true
-              value_redirect: temp_set_f
-              range:
-                min: 62
-                max: 90
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: true
-              value_redirect: temp_current_f
-    - id: 101
-      name: mode
-      type: string
-      hidden: true
-    - id: 103
-      name: preset_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: none
-        - dps_val: true
-          value: sleep
-    - id: 104
-      type: string
-      name: fan_mode
-      mapping:
-        - dps_val: "1"
-          value: high
-        - dps_val: "2"
-          value: medium
-        - dps_val: "3"
-          value: low
-    - id: 106
-      name: swing_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: vertical
-    - id: 109
-      type: boolean
-      name: temperature_unit
-      mapping:
-        - dps_val: true
-          value: F
-        - value: C
-    - id: 110
-      type: integer
-      name: temp_set_f
-      range:
-        min: 62
-        max: 90
-      hidden: true
-      optional: true
-    - id: 111
-      type: integer
-      name: temp_current_f
-      hidden: true
-      optional: true
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: "1"
+                value: cool
+              - dps_val: "2"
+                value: heat
+              - dps_val: "3"
+                value: dry
+              - dps_val: "4"
+                value: fan_only
+      - id: 2
+        type: integer
+        name: temperature
+        range:
+          min: 16
+          max: 31
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: true
+                value_redirect: temp_set_f
+                range:
+                  min: 62
+                  max: 90
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: true
+                value_redirect: temp_current_f
+      - id: 101
+        name: mode
+        type: string
+        hidden: true
+      - id: 103
+        name: preset_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: none
+          - dps_val: true
+            value: sleep
+      - id: 104
+        type: string
+        name: fan_mode
+        mapping:
+          - dps_val: "1"
+            value: high
+          - dps_val: "2"
+            value: medium
+          - dps_val: "3"
+            value: low
+      - id: 106
+        name: swing_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: vertical
+      - id: 109
+        type: boolean
+        name: temperature_unit
+        mapping:
+          - dps_val: true
+            value: F
+          - value: C
+      - id: 110
+        type: integer
+        name: temp_set_f
+        range:
+          min: 62
+          max: 90
+        hidden: true
+        optional: true
+      - id: 111
+        type: integer
+        name: temp_current_f
+        hidden: true
+        optional: true
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 32 - 33
custom_components/tuya_local/devices/arlec_panel_heater.yaml

@@ -2,39 +2,38 @@ name: Arlec 2400W Panel Heater
 products:
   - id: 70kki9an9nr0oqbj
     name: Arlec Panel Heater (2400W)
-primary_entity:
-  entity: climate
-  translation_only_key: heater
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "heat"
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 35
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: low
-          value: eco
-        - dps_val: high
-          value: boost
-        - dps_val: af
-          value: away
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: heater
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "heat"
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 35
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: low
+            value: eco
+          - dps_val: high
+            value: boost
+          - dps_val: af
+            value: away
   - entity: lock
     translation_key: child_lock
     category: config

+ 35 - 36
custom_components/tuya_local/devices/arlec_panel_heater_v2.yaml

@@ -2,42 +2,41 @@ name: Arlec 2200W Panel Heater
 products:
   - id: zf4japp0z9hihzsz
     name: Arlec Panel Heater PEH225HA
-primary_entity:
-  entity: climate
-  translation_only_key: heater
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "heat"
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 50
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: string
-      optional: true
-      mapping:
-        - dps_val: ECO
-          value: eco
-        - dps_val: Comfort
-          value: comfort
-        - dps_val: Antifrost
-          value: away
-        - dps_val: null
-          value: unknown
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: heater
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "heat"
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 50
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: string
+        optional: true
+        mapping:
+          - dps_val: ECO
+            value: eco
+          - dps_val: Comfort
+            value: comfort
+          - dps_val: Antifrost
+            value: away
+          - dps_val: null
+            value: unknown
   - entity: lock
     translation_key: child_lock
     category: config

+ 10 - 11
custom_components/tuya_local/devices/arlec_pb88uha_s2_switch.yaml

@@ -2,17 +2,16 @@ name: Quad powerboard
 products:
   - id: vcbjjhz6pwwwkyek
     name: Arlec PB88UHA Series 2
-primary_entity:
-  entity: switch
-  translation_key: outlet_x
-  translation_placeholders:
-    x: "1"
-  class: outlet
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    translation_key: outlet_x
+    translation_placeholders:
+      x: "1"
+    class: outlet
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: switch
     translation_key: outlet_x
     translation_placeholders:

+ 51 - 52
custom_components/tuya_local/devices/arlec_rf_transmitter.yaml

@@ -2,58 +2,57 @@ name: RF transmitter
 products:
   - id: lclekupkvteemsym
     name: Arlec HUBRF06HA 8x8 function 433MHz
-primary_entity:
-  entity: select
-  name: Remote 1
-  dps:
-    - id: 101
-      type: string
-      name: option
-      mapping:
-        - dps_val: Button1
-          value: Button 1
-        - dps_val: Button2
-          value: Button 2
-        - dps_val: Button3
-          value: Button 3
-        - dps_val: Button4
-          value: Button 4
-        - dps_val: Button5
-          value: Button 5
-        - dps_val: Button6
-          value: Button 6
-        - dps_val: Button7
-          value: Button 7
-        - dps_val: Button8
-          value: Button 8
-          # Apart from 101 and 113, all dps are write only.
-          # 113 is read only, but usually does not appear, 101 is read/write.
-          # The following are some write only dps that are not documented
-          # well enough to usefully expose them.
-    - id: 109
-      type: string
-      optional: true
-      name: button_operations
-      # Documented as raw format: 0x01 learn, 0x02 test 0x03 delete 0x04 save
-      # The following are undocumented, but names suggest they are for
-      # relabelling remotes and buttons.  But since they are write only
-      # it is not clear what point there is to that for remote names.
-      # For buttons, they might change the return code though, which will
-      # mess up the select entities, because we don't know what to send if
-      # they are renamed.
-    - id: 110
-      type: string
-      optional: true
-      name: button_list
-    - id: 111
-      type: string
-      optional: true
-      name: remote_list
-    - id: 112
-      type: string
-      optional: true
-      name: remote_name_store
-secondary_entities:
+entities:
+  - entity: select
+    name: Remote 1
+    dps:
+      - id: 101
+        type: string
+        name: option
+        mapping:
+          - dps_val: Button1
+            value: Button 1
+          - dps_val: Button2
+            value: Button 2
+          - dps_val: Button3
+            value: Button 3
+          - dps_val: Button4
+            value: Button 4
+          - dps_val: Button5
+            value: Button 5
+          - dps_val: Button6
+            value: Button 6
+          - dps_val: Button7
+            value: Button 7
+          - dps_val: Button8
+            value: Button 8
+            # Apart from 101 and 113, all dps are write only.
+            # 113 is read only, but usually does not appear, 101 is read/write.
+            # The following are some write only dps that are not documented
+            # well enough to usefully expose them.
+      - id: 109
+        type: string
+        optional: true
+        name: button_operations
+        # Documented as raw format: 0x01 learn, 0x02 test 0x03 delete 0x04 save
+        # The following are undocumented, but names suggest they are for
+        # relabelling remotes and buttons.  But since they are write only
+        # it is not clear what point there is to that for remote names.
+        # For buttons, they might change the return code though, which will
+        # mess up the select entities, because we don't know what to send if
+        # they are renamed.
+      - id: 110
+        type: string
+        optional: true
+        name: button_list
+      - id: 111
+        type: string
+        optional: true
+        name: remote_list
+      - id: 112
+        type: string
+        optional: true
+        name: remote_name_store
   - entity: select
     name: Remote 2
     dps:

+ 58 - 59
custom_components/tuya_local/devices/arlec_rgb_ledstrip.yaml

@@ -2,65 +2,64 @@ name: RGB light
 products:
   - id: jawcej1v
     name: Arlec ALD261HA USB strip light
-primary_entity:
-  entity: light
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 2
-      type: string
-      name: color_mode
-      mapping:
-        - dps_val: white
-          value: white
-        - dps_val: colour
-          value: hs
-        - dps_val: scene
-          value: Scene
-        - dps_val: music
-          value: Music
-    - id: 5
-      type: hex
-      name: rgbhsv
-      format:
-        - name: h
-          bytes: 2
-          range:
-            min: 0
-            max: 360
-        - name: s
-          bytes: 2
-          range:
-            min: 0
-            max: 1000
-        - name: v
-          bytes: 2
-          range:
-            min: 0
-            max: 1000
-    - id: 5
-      type: hex
-      name: brightness
-      range:
-        min: 0
-        max: 1000
-      mask: "00000000FFFF"
-    - id: 6
-      type: hex
-      name: scene_data
-    - id: 8
-      type: string
-      optional: true
-      name: music_data
-    - id: 9
-      type: string
-      optional: true
-      name: control_data
-    - id: 42
-      type: string
-      name: mic_music_data
-secondary_entities:
+entities:
+  - entity: light
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 2
+        type: string
+        name: color_mode
+        mapping:
+          - dps_val: white
+            value: white
+          - dps_val: colour
+            value: hs
+          - dps_val: scene
+            value: Scene
+          - dps_val: music
+            value: Music
+      - id: 5
+        type: hex
+        name: rgbhsv
+        format:
+          - name: h
+            bytes: 2
+            range:
+              min: 0
+              max: 360
+          - name: s
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+          - name: v
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+      - id: 5
+        type: hex
+        name: brightness
+        range:
+          min: 0
+          max: 1000
+        mask: "00000000FFFF"
+      - id: 6
+        type: hex
+        name: scene_data
+      - id: 8
+        type: string
+        optional: true
+        name: music_data
+      - id: 9
+        type: string
+        optional: true
+        name: control_data
+      - id: 42
+        type: string
+        name: mic_music_data
   - entity: number
     translation_key: timer
     class: duration

+ 14 - 15
custom_components/tuya_local/devices/arlec_smart_button.yaml

@@ -2,21 +2,20 @@ name: Smart Button
 products:
   - id: kpzc6pm8
     name: Arlec SG022HA
-primary_entity:
-  entity: event
-  class: button
-  dps:
-    - id: 1
-      type: string
-      name: event
-      mapping:
-        - dps_val: single_click
-          value: single_click
-        - dps_val: long_press
-          value: long_press
-        - dps_val: double_click
-          value: double_click
-secondary_entities:
+entities:
+  - entity: event
+    class: button
+    dps:
+      - id: 1
+        type: string
+        name: event
+        mapping:
+          - dps_val: single_click
+            value: single_click
+          - dps_val: long_press
+            value: long_press
+          - dps_val: double_click
+            value: double_click
   - entity: sensor
     class: battery
     category: diagnostic

+ 91 - 92
custom_components/tuya_local/devices/arlec_thermostat_smartplug.yaml

@@ -2,98 +2,97 @@ name: Arlec thermostat smartplug
 products:
   - id: 1z2w76xtiawhxleg
     name: Arlec PCTH01HA
-primary_entity:
-  entity: climate
-  dps:
-    - id: 9
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: work_mode
-          conditions:
-            - dps_val: "hot"
-              value: "heat"
-            - dps_val: "dehumidify"
-              value: "dry"
-            - dps_val: "colding"
-              value: "cool"
-            - dps_val: "wet"
-              # There is no humidify/wet mode in HA climate platform
-              value: "fan_only"
-    - id: 7
-      type: string
-      name: cycle_time
-      optional: true
-    - id: 8
-      type: string
-      name: work_mode
-      hidden: true
-    - id: 19
-      type: bitfield
-      name: factory_test
-      optional: true
-    - id: 20
-      type: string
-      name: temperature_unit
-      mapping:
-        - dps_val: c
-          value: C
-        - dps_val: f
-          value: F
-    - id: 21
-      name: temp_set_f
-      type: integer
-      hidden: true
-      mapping:
-        - scale: 10
-          step: 5
-      range:
-        min: -40
-        max: 2210
-    - id: 22
-      name: temperature
-      type: integer
-      range:
-        min: -200
-        max: 1050
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              value_redirect: temp_set_f
-              range:
-                min: -40
-                max: 2210
-          scale: 10
-          step: 5
-    - id: 27
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-          constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              value_redirect: cur_temp_f
-    - id: 28
-      type: integer
-      name: cur_temp_f
-      hidden: true
-      mapping:
-        - scale: 10
-    - id: 41
-      type: integer
-      name: humidity
-      range:
-        min: 1
-        max: 99
-    - id: 46
-      type: integer
-      name: current_humidity
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 9
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: work_mode
+            conditions:
+              - dps_val: "hot"
+                value: "heat"
+              - dps_val: "dehumidify"
+                value: "dry"
+              - dps_val: "colding"
+                value: "cool"
+              - dps_val: "wet"
+                # There is no humidify/wet mode in HA climate platform
+                value: "fan_only"
+      - id: 7
+        type: string
+        name: cycle_time
+        optional: true
+      - id: 8
+        type: string
+        name: work_mode
+        hidden: true
+      - id: 19
+        type: bitfield
+        name: factory_test
+        optional: true
+      - id: 20
+        type: string
+        name: temperature_unit
+        mapping:
+          - dps_val: c
+            value: C
+          - dps_val: f
+            value: F
+      - id: 21
+        name: temp_set_f
+        type: integer
+        hidden: true
+        mapping:
+          - scale: 10
+            step: 5
+        range:
+          min: -40
+          max: 2210
+      - id: 22
+        name: temperature
+        type: integer
+        range:
+          min: -200
+          max: 1050
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                value_redirect: temp_set_f
+                range:
+                  min: -40
+                  max: 2210
+            scale: 10
+            step: 5
+      - id: 27
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+            constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                value_redirect: cur_temp_f
+      - id: 28
+        type: integer
+        name: cur_temp_f
+        hidden: true
+        mapping:
+          - scale: 10
+      - id: 41
+        type: integer
+        name: humidity
+        range:
+          min: 1
+          max: 99
+      - id: 46
+        type: integer
+        name: current_humidity
   - entity: switch
     class: switch
     name: Manual Switch

+ 100 - 101
custom_components/tuya_local/devices/asahom_outdoor_rgbcw_lights.yaml

@@ -2,107 +2,106 @@ name: Decorative lights
 products:
   - id: wcx02kgo8o1qwaf8
     name: Asahom S105A C
-primary_entity:
-  entity: light
-  dps:
-    - id: 20
-      type: boolean
-      name: switch
-    - id: 21
-      name: effect
-      type: string
-      mapping:
-        - dps_val: color
-          value: "off"
-        - dps_val: animation
-          value: Animation
-        - dps_val: music
-          value: Music
-        - dps_val: timer
-          value: Timer
-    - id: 22
-      name: brightness
-      type: integer
-      range:
-        min: 10
-        max: 1000
-    - id: 23
-      name: color_temp
-      type: integer
-      range:
-        min: 0
-        max: 1000
-      mapping:
-        - target_range:
-            min: 2700
-            max: 6500
-    - id: 24
-      name: rgbhsv
-      optional: true
-      type: hex
-      format:
-        - name: h
-          bytes: 2
-          range:
-            min: 0
-            max: 360
-        - name: s
-          bytes: 2
-          range:
-            min: 0
-            max: 1000
-        - name: v
-          bytes: 2
-          range:
-            min: 0
-            max: 1000
-    - id: 27
-      type: string
-      optional: true
-      name: music_data
-    - id: 101
-      type: string
-      name: color_addressable
-    - id: 102
-      type: string
-      optional: true
-      name: color_favorite
-    - id: 103
-      type: string
-      optional: true
-      name: animation_preset
-    - id: 104
-      type: string
-      optional: true
-      name: animation_diy
-    - id: 106
-      type: integer
-      name: light_count
-    - id: 107
-      type: string
-      optional: true
-      name: animation_folder
-    - id: 108
-      type: string
-      optional: true
-      name: music_devicedata
-    - id: 109
-      type: string
-      optional: true
-      name: button_setting
-    - id: 110
-      type: string
-      optional: true
-      name: splitter_setting
-    - id: 111
-      type: integer
-      optional: true
-      name: color_brightness
-    - id: 116
-      type: string
-      optional: true
-      name: color_sync
-secondary_entities:
+entities:
+  - entity: light
+    dps:
+      - id: 20
+        type: boolean
+        name: switch
+      - id: 21
+        name: effect
+        type: string
+        mapping:
+          - dps_val: color
+            value: "off"
+          - dps_val: animation
+            value: Animation
+          - dps_val: music
+            value: Music
+          - dps_val: timer
+            value: Timer
+      - id: 22
+        name: brightness
+        type: integer
+        range:
+          min: 10
+          max: 1000
+      - id: 23
+        name: color_temp
+        type: integer
+        range:
+          min: 0
+          max: 1000
+        mapping:
+          - target_range:
+              min: 2700
+              max: 6500
+      - id: 24
+        name: rgbhsv
+        optional: true
+        type: hex
+        format:
+          - name: h
+            bytes: 2
+            range:
+              min: 0
+              max: 360
+          - name: s
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+          - name: v
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+      - id: 27
+        type: string
+        optional: true
+        name: music_data
+      - id: 101
+        type: string
+        name: color_addressable
+      - id: 102
+        type: string
+        optional: true
+        name: color_favorite
+      - id: 103
+        type: string
+        optional: true
+        name: animation_preset
+      - id: 104
+        type: string
+        optional: true
+        name: animation_diy
+      - id: 106
+        type: integer
+        name: light_count
+      - id: 107
+        type: string
+        optional: true
+        name: animation_folder
+      - id: 108
+        type: string
+        optional: true
+        name: music_devicedata
+      - id: 109
+        type: string
+        optional: true
+        name: button_setting
+      - id: 110
+        type: string
+        optional: true
+        name: splitter_setting
+      - id: 111
+        type: integer
+        optional: true
+        name: color_brightness
+      - id: 116
+        type: string
+        optional: true
+        name: color_sync
   - entity: number
     translation_key: timer
     class: duration

+ 15 - 16
custom_components/tuya_local/devices/asakuki_diffuser.yaml

@@ -2,22 +2,21 @@ name: Aroma diffuser
 products:
   - id: 6ASdNwe9IdaewQEl
     name: Asakuki cube light
-primary_entity:
-  entity: fan
-  translation_key: aroma_diffuser
-  dps:
-    - id: 11
-      type: boolean
-      name: switch
-    - id: 13
-      type: string
-      name: speed
-      mapping:
-        - dps_val: "0"
-          value: 50
-        - dps_val: "1"
-          value: 100
-secondary_entities:
+entities:
+  - entity: fan
+    translation_key: aroma_diffuser
+    dps:
+      - id: 11
+        type: boolean
+        name: switch
+      - id: 13
+        type: string
+        name: speed
+        mapping:
+          - dps_val: "0"
+            value: 50
+          - dps_val: "1"
+            value: 100
   - entity: light
     dps:
       - id: 1

+ 6 - 7
custom_components/tuya_local/devices/asc_wifi_circuit_breaker.yaml

@@ -1,13 +1,12 @@
 name: ASC (Wi-Fi)
 products:
   - id: yrzel5nutomegk6z
-primary_entity:
-  entity: switch
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-secondary_entities:
+entities:
+  - entity: switch
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
   - entity: number
     translation_key: timer
     class: duration

+ 8 - 9
custom_components/tuya_local/devices/asip_0622_planter.yaml

@@ -2,15 +2,14 @@ name: Planter
 # products:
 #   - id:
 #     name: ASIP-0622 indoor planter
-primary_entity:
-  entity: switch
-  icon: "mdi:sprout"
-  name: Power
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    icon: "mdi:sprout"
+    name: Power
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: switch
     name: Pump
     icon: "mdi:water-pump"

+ 34 - 35
custom_components/tuya_local/devices/aspen_asp200_fan.yaml

@@ -1,40 +1,39 @@
 name: Aspen fan
 legacy_type: aspen_fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 2
-      type: string
-      name: direction
-      mapping:
-        - dps_val: in
-          value: forward
-        - dps_val: out
-          value: reverse
-        - dps_val: exch
-          value: exchange
-    - id: 3
-      type: integer
-      name: speed
-      range:
-        min: 1
-        max: 3
-    - id: 101
-      type: boolean
-      name: preset_mode
-      mapping:
-        - dps_val: false
-          value: "normal"
-        - dps_val: true
-          value: "smart"
-    - id: 8
-      type: integer
-      name: unknown_8
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 2
+        type: string
+        name: direction
+        mapping:
+          - dps_val: in
+            value: forward
+          - dps_val: out
+            value: reverse
+          - dps_val: exch
+            value: exchange
+      - id: 3
+        type: integer
+        name: speed
+        range:
+          min: 1
+          max: 3
+      - id: 101
+        type: boolean
+        name: preset_mode
+        mapping:
+          - dps_val: false
+            value: "normal"
+          - dps_val: true
+            value: "smart"
+      - id: 8
+        type: integer
+        name: unknown_8
   - entity: climate
     dps:
       - id: 1

+ 24 - 25
custom_components/tuya_local/devices/atomi_ceiling_fan.yaml

@@ -2,31 +2,30 @@ name: Ceiling fan
 products:
   - id: keyxcgdguks9shua
     name: Atomi 52 inch ceiling fan
-primary_entity:
-  entity: fan
-  translation_only_key: fan_with_presets
-  dps:
-    - id: 60
-      type: boolean
-      name: switch
-    - id: 61
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: fresh
-          value: fresh
-        - dps_val: nature
-          value: nature
-    - id: 64
-      type: integer
-      name: speed
-      range:
-        min: 1
-        max: 3
-    - id: 71
-      type: string
-      name: unknown_71
-secondary_entities:
+entities:
+  - entity: fan
+    translation_only_key: fan_with_presets
+    dps:
+      - id: 60
+        type: boolean
+        name: switch
+      - id: 61
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: fresh
+            value: fresh
+          - dps_val: nature
+            value: nature
+      - id: 64
+        type: integer
+        name: speed
+        range:
+          min: 1
+          max: 3
+      - id: 71
+        type: string
+        name: unknown_71
   - entity: light
     dps:
       - id: 20

+ 42 - 43
custom_components/tuya_local/devices/atomi_ceramic_heater.yaml

@@ -4,49 +4,48 @@ products:
     name: Atomi AT1632
   - id: tos0dbspyikjzcxe
     name: Atomi AT1635
-primary_entity:
-  entity: climate
-  translation_only_key: heater
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: heat
-    - id: 2
-      type: integer
-      name: temperature
-      range:
-        min: 60
-        max: 86
-      unit: F
-    - id: 3
-      type: integer
-      name: current_temperature
-    - id: 4
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: auto
-          value: eco
-        - dps_val: low
-          value: comfort
-        - dps_val: high
-          value: boost
-    - id: 8
-      type: boolean
-      name: swing_mode
-      # not available on AT1635
-      optional: true
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: horizontal
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: heater
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: heat
+      - id: 2
+        type: integer
+        name: temperature
+        range:
+          min: 60
+          max: 86
+        unit: F
+      - id: 3
+        type: integer
+        name: current_temperature
+      - id: 4
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: auto
+            value: eco
+          - dps_val: low
+            value: comfort
+          - dps_val: high
+            value: boost
+      - id: 8
+        type: boolean
+        name: swing_mode
+        # not available on AT1635
+        optional: true
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: horizontal
   - entity: light
     translation_key: display
     category: config

+ 77 - 77
custom_components/tuya_local/devices/atomi_string_lights.yaml

@@ -1,78 +1,78 @@
 name: Atomi string lights
-primary_entity:
-  entity: light
-  dps:
-    - id: 20
-      type: boolean
-      name: switch
-    - id: 21
-      type: string
-      name: color_mode
-      mapping:
-        - dps_val: white
-          value: color_temp
-        - dps_val: colour
-          value: hs
-        - dps_val: scene1
-          value: Strobe
-        - dps_val: scene2
-          value: Fade
-        - dps_val: scene3
-          value: Pulse
-        - dps_val: scene4
-          value: Blink
-        - dps_val: scene5
-          value: Chase
-        - dps_val: scene6
-          value: Christmas
-        - dps_val: scene7
-          value: America
-        - dps_val: scene8
-          value: Pick 2
-        - dps_val: scene9
-          value: Multi
-    - id: 22
-      name: brightness
-      type: integer
-      range:
-        min: 0
-        max: 255
-    - id: 23
-      name: color_temp
-      type: integer
-      range:
-        min: 0
-        max: 255
-      mapping:
-        - target_range:
-            min: 2700
-            max: 6500
-    - id: 24
-      name: rgbhsv
-      type: hex
-      format:
-        - name: r
-          bytes: 1
-        - name: g
-          bytes: 1
-        - name: b
-          bytes: 1
-        - name: h
-          bytes: 2
-          range:
-            min: 0
-            max: 360
-        - name: s
-          bytes: 1
-          range:
-            min: 0
-            max: 255
-        - name: v
-          bytes: 1
-          range:
-            min: 0
-            max: 255
-    - id: 101
-      name: scene_data
-      type: hex
-      optional: true
+entities:
+  - entity: light
+    dps:
+      - id: 20
+        type: boolean
+        name: switch
+      - id: 21
+        type: string
+        name: color_mode
+        mapping:
+          - dps_val: white
+            value: color_temp
+          - dps_val: colour
+            value: hs
+          - dps_val: scene1
+            value: Strobe
+          - dps_val: scene2
+            value: Fade
+          - dps_val: scene3
+            value: Pulse
+          - dps_val: scene4
+            value: Blink
+          - dps_val: scene5
+            value: Chase
+          - dps_val: scene6
+            value: Christmas
+          - dps_val: scene7
+            value: America
+          - dps_val: scene8
+            value: Pick 2
+          - dps_val: scene9
+            value: Multi
+      - id: 22
+        name: brightness
+        type: integer
+        range:
+          min: 0
+          max: 255
+      - id: 23
+        name: color_temp
+        type: integer
+        range:
+          min: 0
+          max: 255
+        mapping:
+          - target_range:
+              min: 2700
+              max: 6500
+      - id: 24
+        name: rgbhsv
+        type: hex
+        format:
+          - name: r
+            bytes: 1
+          - name: g
+            bytes: 1
+          - name: b
+            bytes: 1
+          - name: h
+            bytes: 2
+            range:
+              min: 0
+              max: 360
+          - name: s
+            bytes: 1
+            range:
+              min: 0
+              max: 255
+          - name: v
+            bytes: 1
+            range:
+              min: 0
+              max: 255
+      - id: 101
+        name: scene_data
+        type: hex
+        optional: true

+ 10 - 11
custom_components/tuya_local/devices/atorch_at2pl_breaker.yaml

@@ -4,17 +4,16 @@ products:
     name: Atorch AT2PL
   - id: sq1ahfxhgove4kgo
     name: Atorch GR2PWS
-primary_entity:
-  entity: switch
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 17
-      type: integer
-      optional: true
-      name: add_ele
-secondary_entities:
+entities:
+  - entity: switch
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 17
+        type: integer
+        optional: true
+        name: add_ele
   - entity: number
     translation_key: timer
     class: duration

+ 7 - 8
custom_components/tuya_local/devices/atorch_at4pw_energymeter.yaml

@@ -2,14 +2,13 @@ name: Energy meter
 products:
   - id: tjtigg991kvoiiqi
     name: ATorch AT4PBWP
-primary_entity:
-  entity: switch
-  class: outlet
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    class: outlet
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: number
     category: config
     translation_key: timer

+ 8 - 9
custom_components/tuya_local/devices/atorch_s1wp.yaml

@@ -2,15 +2,14 @@ name: Energy monitoring plug with display
 products:
   - id: sqrf2g1amfutn4co
     name: Atorch S1WP
-primary_entity:
-  entity: switch
-  class: outlet
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-      optional: true
-secondary_entities:
+entities:
+  - entity: switch
+    class: outlet
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+        optional: true
   - entity: number
     category: config
     class: duration

+ 18 - 19
custom_components/tuya_local/devices/aubess_1gang_switch.yaml

@@ -4,25 +4,24 @@ products:
   #   name: Aubess 1-gang
   - id: m4jtkjc43ltrilru
     name: T34 Smart Plug+
-primary_entity:
-  entity: switch
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 24
-      name: test_bit
-      type: integer
-    - id: 42
-      name: random_time
-      type: string
-    - id: 43
-      name: cycle_time
-      type: string
-    - id: 44
-      name: switch_inching
-      type: string
-secondary_entities:
+entities:
+  - entity: switch
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 24
+        name: test_bit
+        type: integer
+      - id: 42
+        name: random_time
+        type: string
+      - id: 43
+        name: cycle_time
+        type: string
+      - id: 44
+        name: switch_inching
+        type: string
   - entity: number
     translation_key: timer
     class: duration

+ 22 - 23
custom_components/tuya_local/devices/aubess_2gang_switch.yaml

@@ -2,29 +2,28 @@ name: Double switch
 products:
   - id: zexdotwigwiobadr
     name: SciMagic RX Double Garage door receiver
-primary_entity:
-  entity: switch
-  translation_key: switch_x
-  translation_placeholders:
-    x: "1"
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 42
-      type: string
-      name: random_schedule
-    - id: 43
-      type: string
-      name: repeating_schedule
-    - id: 44
-      type: string
-      name: inching
-    - id: 48
-      type: string
-      optional: true
-      name: interlock
-secondary_entities:
+entities:
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: "1"
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 42
+        type: string
+        name: random_schedule
+      - id: 43
+        type: string
+        name: repeating_schedule
+      - id: 44
+        type: string
+        name: inching
+      - id: 48
+        type: string
+        optional: true
+        name: interlock
   - entity: switch
     translation_key: switch_x
     translation_placeholders:

+ 7 - 8
custom_components/tuya_local/devices/aubess_rainpoint_irrigation_system.yaml

@@ -2,14 +2,13 @@ name: Irrigation system
 products:
   - id: 2ak7r2culspkc7hx
     name: Aubess RainPoint TTP106W
-primary_entity:
-  entity: valve
-  class: water
-  dps:
-    - id: 1
-      name: valve
-      type: boolean
-secondary_entities:
+entities:
+  - entity: valve
+    class: water
+    dps:
+      - id: 1
+        name: valve
+        type: boolean
   - entity: switch
     icon: "mdi:pipe-valve"
     deprecated: valve

+ 12 - 13
custom_components/tuya_local/devices/aulifants_energymonitor_breaker.yaml

@@ -2,19 +2,18 @@ name: Circuit breaker
 products:
   - id: qndxewijhpsz3ixr
     name: Aulifants SMES200
-primary_entity:
-  entity: sensor
-  name: Total energy
-  class: energy
-  dps:
-    - id: 1
-      type: integer
-      name: sensor
-      unit: kWh
-      class: total_increasing
-      mapping:
-        - scale: 100
-secondary_entities:
+entities:
+  - entity: sensor
+    name: Total energy
+    class: energy
+    dps:
+      - id: 1
+        type: integer
+        name: sensor
+        unit: kWh
+        class: total_increasing
+        mapping:
+          - scale: 100
   - entity: sensor
     class: voltage
     dps:

+ 23 - 24
custom_components/tuya_local/devices/avatto_curtain_duallights.yaml

@@ -2,30 +2,29 @@ name: Curtain and lights
 products:
   - id: n76sxga6lyfujuac
     name: Avatto SYS-CL02
-primary_entity:
-  entity: cover
-  class: curtain
-  dps:
-    - id: 1
-      name: control
-      type: string
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-    - id: 2
-      name: position
-      type: integer
-      unit: "%"
-      range:
-        min: 0
-        max: 100
-      mapping:
-        - step: 10
-secondary_entities:
+entities:
+  - entity: cover
+    class: curtain
+    dps:
+      - id: 1
+        name: control
+        type: string
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
+      - id: 2
+        name: position
+        type: integer
+        unit: "%"
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - step: 10
   - entity: light
     name: Light 1
     dps:

+ 23 - 24
custom_components/tuya_local/devices/avatto_curtain_light.yaml

@@ -2,30 +2,29 @@ name: Avatto Curtain and Light
 products:
   - id: v59tpvs4ubvjalhq
     name: Avatto CB3S
-primary_entity:
-  entity: cover
-  class: curtain
-  dps:
-    - id: 1
-      name: control
-      type: string
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-    - id: 2
-      name: position
-      type: integer
-      unit: "%"
-      range:
-        min: 0
-        max: 100
-      mapping:
-        - step: 10
-secondary_entities:
+entities:
+  - entity: cover
+    class: curtain
+    dps:
+      - id: 1
+        name: control
+        type: string
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
+      - id: 2
+        name: position
+        type: integer
+        unit: "%"
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - step: 10
   - entity: light
     dps:
       - id: 102

+ 14 - 15
custom_components/tuya_local/devices/avatto_curtain_switch.yaml

@@ -1,19 +1,18 @@
 name: Avatto curtain switch
-primary_entity:
-  entity: cover
-  class: curtain
-  dps:
-    - id: 1
-      name: control
-      type: string
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-secondary_entities:
+entities:
+  - entity: cover
+    class: curtain
+    dps:
+      - id: 1
+        name: control
+        type: string
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
   - entity: light
     category: config
     translation_key: backlight

+ 55 - 56
custom_components/tuya_local/devices/avatto_roller_blinds.yaml

@@ -2,62 +2,61 @@ name: Roller blinds
 products:
   - id: 3r8gc33pnqsxfe1g
     name: Quoya MC08 blinds motor
-primary_entity:
-  entity: cover
-  class: blind
-  dps:
-    - id: 1
-      name: control
-      type: string
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-    - id: 2
-      name: position
-      type: integer
-      range:
-        min: 0
-        max: 100
-      mapping:
-        - invert: true
-    - id: 3
-      name: current_position
-      type: integer
-      unit: "%"
-      optional: true
-      persist: false
-      mapping:
-        - invert: true
-      range:
-        min: 0
-        max: 100
-    - id: 7
-      name: action
-      type: string
-      optional: true
-      persist: false
-      mapping:
-        - dps_val: opening
-          value: opening
-          constraint: current_position
-          conditions:
-            - dps_val: 0
-              value: opened
-            - dps_val: null
-              value: null
-        - dps_val: closing
-          value: closing
-          constraint: current_position
-          conditions:
-            - dps_val: 100
-              value: closed
-            - dps_val: null
-              value: null
-secondary_entities:
+entities:
+  - entity: cover
+    class: blind
+    dps:
+      - id: 1
+        name: control
+        type: string
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
+      - id: 2
+        name: position
+        type: integer
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - invert: true
+      - id: 3
+        name: current_position
+        type: integer
+        unit: "%"
+        optional: true
+        persist: false
+        mapping:
+          - invert: true
+        range:
+          min: 0
+          max: 100
+      - id: 7
+        name: action
+        type: string
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: opening
+            value: opening
+            constraint: current_position
+            conditions:
+              - dps_val: 0
+                value: opened
+              - dps_val: null
+                value: null
+          - dps_val: closing
+            value: closing
+            constraint: current_position
+            conditions:
+              - dps_val: 100
+                value: closed
+              - dps_val: null
+                value: null
   - entity: select
     translation_key: timer
     category: config

+ 42 - 43
custom_components/tuya_local/devices/avatto_trv06_radiatorvalve.yaml

@@ -2,49 +2,48 @@ name: Radiator
 products:
   - id: ow09xlxm
     name: Avatto/Thaleos TRV06
-primary_entity:
-  entity: climate
-  translation_key: heater
-  dps:
-    - id: 2
-      type: string
-      name: hvac_mode
-      optional: true
-      mapping:
-        - dps_val: "off"
-          value: "off"
-        - dps_val: manual
-          value: heat
-        - dps_val: auto
-          value: auto
-        - dps_val: null
-          value: "off"
-          hidden: true
-    - id: 3
-      type: string
-      name: hvac_action
-      optional: true
-      mapping:
-        - dps_val: opened
-          value: heating
-        - dps_val: closed
-          value: idle
-    - id: 4
-      type: integer
-      name: temperature
-      unit: C
-      mapping:
-        - scale: 10
-          step: 10
-      range:
-        min: 50
-        max: 350
-    - id: 5
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-secondary_entities:
+entities:
+  - entity: climate
+    translation_key: heater
+    dps:
+      - id: 2
+        type: string
+        name: hvac_mode
+        optional: true
+        mapping:
+          - dps_val: "off"
+            value: "off"
+          - dps_val: manual
+            value: heat
+          - dps_val: auto
+            value: auto
+          - dps_val: null
+            value: "off"
+            hidden: true
+      - id: 3
+        type: string
+        name: hvac_action
+        optional: true
+        mapping:
+          - dps_val: opened
+            value: heating
+          - dps_val: closed
+            value: idle
+      - id: 4
+        type: integer
+        name: temperature
+        unit: C
+        mapping:
+          - scale: 10
+            step: 10
+        range:
+          min: 50
+          max: 350
+      - id: 5
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
   - entity: lock
     translation_key: child_lock
     category: config

+ 59 - 60
custom_components/tuya_local/devices/avatto_wt100_thermostat.yaml

@@ -2,66 +2,65 @@ name: Thermostat
 products:
   - id: gw173aldekvpzalg
     name: Avatto WT200W-EH
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: preset_mode
-          conditions:
-            - dps_val: cold
-              # manual
-              value: heat
-            - dps_val: hot
-              # program
-              value: auto
-            - dps_val: wind
-              # temporary program - HA does not have a distinct mode for this
-              value: auto
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      optional: true
-      range:
-        min: 50
-        max: 700
-      mapping:
-        - scale: 10
-    - id: 3
-      name: current_temperature
-      type: integer
-      mapping:
-        - scale: 10
-    - id: 4
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: cold
-          value: manual
-        - dps_val: hot
-          value: program
-        - dps_val: wind
-          value: temp_override
-          hidden: true
-    - id: 5
-      name: hvac_action
-      type: string
-      mapping:
-        - dps_val: "0"
-          value: idle
-        - dps_val: "1"
-          value: heating
-    - id: 21
-      name: max_temperature
-      type: integer
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: preset_mode
+            conditions:
+              - dps_val: cold
+                # manual
+                value: heat
+              - dps_val: hot
+                # program
+                value: auto
+              - dps_val: wind
+                # temporary program - HA does not have a distinct mode for this
+                value: auto
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        optional: true
+        range:
+          min: 50
+          max: 700
+        mapping:
+          - scale: 10
+      - id: 3
+        name: current_temperature
+        type: integer
+        mapping:
+          - scale: 10
+      - id: 4
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: cold
+            value: manual
+          - dps_val: hot
+            value: program
+          - dps_val: wind
+            value: temp_override
+            hidden: true
+      - id: 5
+        name: hvac_action
+        type: string
+        mapping:
+          - dps_val: "0"
+            value: idle
+          - dps_val: "1"
+            value: heating
+      - id: 21
+        name: max_temperature
+        type: integer
   - entity: lock
     translation_key: child_lock
     category: config

+ 20 - 21
custom_components/tuya_local/devices/avidsen_soria_solarinverter.yaml

@@ -2,27 +2,26 @@ name: Solar inverter
 products:
   - id: 0kllybtbzftaee7y
     name: Avidsen Soria Karst-400
-primary_entity:
-  entity: sensor
-  class: energy
-  dps:
-    - id: 2
-      type: integer
-      name: sensor
-      unit: kWh
-      class: total_increasing
-      mapping:
-        - scale: 100
-    - id: 15
-      name: inverter_type
-      type: string
-    - id: 16
-      name: inverter_id
-      type: string
-    - id: 17
-      name: imei_imsi
-      type: string
-secondary_entities:
+entities:
+  - entity: sensor
+    class: energy
+    dps:
+      - id: 2
+        type: integer
+        name: sensor
+        unit: kWh
+        class: total_increasing
+        mapping:
+          - scale: 100
+      - id: 15
+        name: inverter_type
+        type: string
+      - id: 16
+        name: inverter_id
+        type: string
+      - id: 17
+        name: imei_imsi
+        type: string
   - entity: switch
     name: Inverter switch
     category: config

+ 72 - 73
custom_components/tuya_local/devices/awow_th213_thermostat.yaml

@@ -1,77 +1,76 @@
 name: TH213 thermostat
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "heat"
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 30
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: home
-        - dps_val: 2
-          value: away
-        - dps_val: 3
-          value: activity
-        - dps_val: 4
-          value: sleep
-    - id: 102
-      type: integer
-      name: sensor
-      mapping:
-        - dps_val: 0
-          value: "Internal"
-        - dps_val: 1
-          value: "External"
-        - dps_val: 2
-          value: "Internal & External"
-    - id: 103
-      type: integer
-      name: temperature_calibration_offset
-      range:
-        min: -9
-        max: 9
-    - id: 104
-      type: integer
-      name: temperature_calibration_swing
-      range:
-        min: 1
-        max: 9
-    - id: 105
-      type: boolean
-      name: hvac_action
-      mapping:
-        - dps_val: true
-          value: heating
-        - dps_val: false
-          value: idle
-    - id: 107
-      type: boolean
-      name: unknown_107
-    - id: 108
-      type: boolean
-      name: unknown_108
-    - id: 110
-      type: integer
-      name: unknown_110
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "heat"
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 30
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: home
+          - dps_val: 2
+            value: away
+          - dps_val: 3
+            value: activity
+          - dps_val: 4
+            value: sleep
+      - id: 102
+        type: integer
+        name: sensor
+        mapping:
+          - dps_val: 0
+            value: "Internal"
+          - dps_val: 1
+            value: "External"
+          - dps_val: 2
+            value: "Internal & External"
+      - id: 103
+        type: integer
+        name: temperature_calibration_offset
+        range:
+          min: -9
+          max: 9
+      - id: 104
+        type: integer
+        name: temperature_calibration_swing
+        range:
+          min: 1
+          max: 9
+      - id: 105
+        type: boolean
+        name: hvac_action
+        mapping:
+          - dps_val: true
+            value: heating
+          - dps_val: false
+            value: idle
+      - id: 107
+        type: boolean
+        name: unknown_107
+      - id: 108
+        type: boolean
+        name: unknown_108
+      - id: 110
+        type: integer
+        name: unknown_110
   - entity: lock
     translation_key: child_lock
     category: config

+ 44 - 45
custom_components/tuya_local/devices/awow_th213v2_thermostat.yaml

@@ -1,49 +1,48 @@
 name: TH213 thermostat
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: "heat"
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 30
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: home
-        - dps_val: 2
-          value: away
-        - dps_val: 3
-          value: activity
-        - dps_val: 4
-          value: sleep
-    - id: 105
-      type: boolean
-      name: hvac_action
-      mapping:
-        - dps_val: true
-          value: heating
-        - dps_val: false
-          value: idle
-    - id: 116
-      type: string
-      name: unknown_116
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: "heat"
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 30
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: home
+          - dps_val: 2
+            value: away
+          - dps_val: 3
+            value: activity
+          - dps_val: 4
+            value: sleep
+      - id: 105
+        type: boolean
+        name: hvac_action
+        mapping:
+          - dps_val: true
+            value: heating
+          - dps_val: false
+            value: idle
+      - id: 116
+        type: string
+        name: unknown_116
   - entity: lock
     translation_key: child_lock
     category: config

+ 7 - 8
custom_components/tuya_local/devices/axen_ks100w_heatpump.yaml

@@ -4,14 +4,13 @@ name: Combo heat pump
 products:
   - id: l01fseshej0xmz8x
     name: Axen KS-100W/EN8BP
-primary_entity:
-  entity: switch
-  category: config
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    category: config
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: binary_sensor
     class: problem
     category: diagnostic

+ 77 - 78
custom_components/tuya_local/devices/aygrochy_inline_wifi_air_vent.yaml

@@ -2,84 +2,83 @@ name: Fan
 # products:
 #   - id: UNKNOWN
 #     name: Aygrochy fan
-primary_entity:
-  entity: climate
-  dps:
-    - id: 2
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: "ON"
-          value: "On"
-        - dps_val: "OFF"
-          value: "Off"
-        - dps_val: "TIMER"
-          value: "Timer"
-        - dps_val: "AUTO"
-          value: "Auto"
-        - dps_val: "ALARM"
-          value: "Alarm"
-    - id: 2
-      name: hvac_mode
-      type: string
-      mapping:
-        - dps_val: "ON"
-          value: "fan_only"
-        - dps_val: "OFF"
-          value: "off"
-        - dps_val: "TIMER"
-          value: "auto"
-          hidden: true
-        - dps_val: "AUTO"
-          value: "auto"
-        - dps_val: "ALARM"
-          value: "fan_only"
-          hidden: true
-    - id: 8
-      name: current_humidity
-      type: integer
-      unit: "%"
-    - id: 9
-      name: current_temperature
-      type: integer
-      unit: "F"
-    - id: 110
-      name: target_temp_high
-      type: integer
-      range:
-        min: 32
-        max: 194
-      unit: "F"
-      mapping:
-        - constraint: hvac_mode
-          conditions:
-            - dps_val: AUTO
-              value_redirect: auto_temp_high
-    - id: 106
-      name: auto_temp_high
-      type: integer
-      range:
-        min: 32
-        max: 194
-    - id: 112
-      name: target_temp_low
-      type: integer
-      range:
-        min: 32
-        max: 194
-      unit: "F"
-      mapping:
-        - constraint: hvac_mode
-          conditions:
-            - dps_val: AUTO
-              value_redirect: auto_temp_low
-    - id: 108
-      name: auto_temp_low
-      type: integer
-      range:
-        min: 32
-        max: 194
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 2
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: "ON"
+            value: "On"
+          - dps_val: "OFF"
+            value: "Off"
+          - dps_val: "TIMER"
+            value: "Timer"
+          - dps_val: "AUTO"
+            value: "Auto"
+          - dps_val: "ALARM"
+            value: "Alarm"
+      - id: 2
+        name: hvac_mode
+        type: string
+        mapping:
+          - dps_val: "ON"
+            value: "fan_only"
+          - dps_val: "OFF"
+            value: "off"
+          - dps_val: "TIMER"
+            value: "auto"
+            hidden: true
+          - dps_val: "AUTO"
+            value: "auto"
+          - dps_val: "ALARM"
+            value: "fan_only"
+            hidden: true
+      - id: 8
+        name: current_humidity
+        type: integer
+        unit: "%"
+      - id: 9
+        name: current_temperature
+        type: integer
+        unit: "F"
+      - id: 110
+        name: target_temp_high
+        type: integer
+        range:
+          min: 32
+          max: 194
+        unit: "F"
+        mapping:
+          - constraint: hvac_mode
+            conditions:
+              - dps_val: AUTO
+                value_redirect: auto_temp_high
+      - id: 106
+        name: auto_temp_high
+        type: integer
+        range:
+          min: 32
+          max: 194
+      - id: 112
+        name: target_temp_low
+        type: integer
+        range:
+          min: 32
+          max: 194
+        unit: "F"
+        mapping:
+          - constraint: hvac_mode
+            conditions:
+              - dps_val: AUTO
+                value_redirect: auto_temp_low
+      - id: 108
+        name: auto_temp_low
+        type: integer
+        range:
+          min: 32
+          max: 194
   - entity: fan
     dps:
       - id: 1

+ 50 - 52
custom_components/tuya_local/devices/ballu_aura.yaml

@@ -2,58 +2,56 @@ name: Air conditioner
 products:
   - id: r9lwbruavixdspeb
     name: "Ballu Aura  9/12"
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: "COOL"
-              value: cool
-            - dps_val: "DRY"
-              value: dry
-            - dps_val: "FAN"
-              value: fan_only
-    - id: 2
-      name: temperature
-      type: integer
-      range:
-        min: 17
-        max: 30
-      unit: C
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: mode
-      type: string
-      hidden: true
-    - id: 5
-      name: fan_mode
-      type: string
-      mapping:
-        - dps_val: "1"
-          value: low
-        - dps_val: "2"
-          value: medium
-        - dps_val: "3"
-          value: high
-    - id: 104
-      name: swing_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          value: vertical
-        - dps_val: false
-          value: "off"
-
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: "COOL"
+                value: cool
+              - dps_val: "DRY"
+                value: dry
+              - dps_val: "FAN"
+                value: fan_only
+      - id: 2
+        name: temperature
+        type: integer
+        range:
+          min: 17
+          max: 30
+        unit: C
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: mode
+        type: string
+        hidden: true
+      - id: 5
+        name: fan_mode
+        type: string
+        mapping:
+          - dps_val: "1"
+            value: low
+          - dps_val: "2"
+            value: medium
+          - dps_val: "3"
+            value: high
+      - id: 104
+        name: swing_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            value: vertical
+          - dps_val: false
+            value: "off"
   - entity: select
     translation_key: temperature_unit
     category: config

+ 12 - 12
custom_components/tuya_local/devices/basic_ir_remote.yaml

@@ -4,15 +4,15 @@ products:
     name: UanTii S06/S18 IR
   - id: ejv37o6yz9vtxcuo
     name: RightSitu S18 IR
-primary_entity:
-  entity: remote
-  dps:
-    - id: 201
-      name: send
-      type: string
-      optional: true
-    - id: 202
-      name: receive
-      type: string
-      optional: true
-      persist: false
+entities:
+  - entity: remote
+    dps:
+      - id: 201
+        name: send
+        type: string
+        optional: true
+      - id: 202
+        name: receive
+        type: string
+        optional: true
+        persist: false

+ 10 - 11
custom_components/tuya_local/devices/bauhn_ap5w0624_powerstrip.yaml

@@ -2,17 +2,16 @@ name: 5-way powerstrip
 products:
   - id: bf152cecbcf4180771k2lq
     name: BAUHN AP5W-0624
-primary_entity:
-  entity: switch
-  translation_key: outlet_x
-  translation_placeholders:
-    x: "1"
-  class: outlet
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    translation_key: outlet_x
+    translation_placeholders:
+      x: "1"
+    class: outlet
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: switch
     translation_key: outlet_x
     translation_placeholders:

+ 22 - 23
custom_components/tuya_local/devices/bcom_intercom_camera.yaml

@@ -2,29 +2,28 @@ name: BCom doorbell
 products:
   - id: bf71b225dc6dd70835wlbt
     name: Bcom Majic IPBox
-primary_entity:
-  entity: camera
-  dps:
-    - id: 150
-      name: record
-      type: boolean
-      optional: true
-    - id: 136
-      name: snapshot
-      type: base64
-      persist: false
-      optional: true
-      sensitive: true
-      mapping:
-        - dps_val: ""
-          value_redirect: motion_detected
-        - dps_val: null
-          value_redirect: motion_detected
-    - id: 115
-      name: motion_detected
-      type: base64
-      sensitive: true
-secondary_entities:
+entities:
+  - entity: camera
+    dps:
+      - id: 150
+        name: record
+        type: boolean
+        optional: true
+      - id: 136
+        name: snapshot
+        type: base64
+        persist: false
+        optional: true
+        sensitive: true
+        mapping:
+          - dps_val: ""
+            value_redirect: motion_detected
+          - dps_val: null
+            value_redirect: motion_detected
+      - id: 115
+        name: motion_detected
+        type: base64
+        sensitive: true
   - entity: lock
     name: Door lock
     dps:

+ 56 - 57
custom_components/tuya_local/devices/beca_bac002_thermostat_c.yaml

@@ -4,63 +4,62 @@ name: Thermostat
 products:
   - id: N8bUqOZ8HBQjU0K0
     name: Becasmart BAC005
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: "0"
-              value: cool
-            - dps_val: "1"
-              value: heat
-            - dps_val: "2"
-              value: fan_only
-    - id: 2
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 10
-        max: 70
-      mapping:
-        - scale: 2
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 2
-    - id: 5
-      type: boolean
-      name: preset_mode
-      mapping:
-        - dps_val: true
-          value: eco
-        - dps_val: false
-          value: comfort
-    - id: 102
-      type: string
-      name: mode
-      hidden: true
-    - id: 103
-      type: string
-      name: fan_mode
-      mapping:
-        - dps_val: "0"
-          value: auto
-        - dps_val: "1"
-          value: high
-        - dps_val: "2"
-          value: medium
-        - dps_val: "3"
-          value: low
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: "0"
+                value: cool
+              - dps_val: "1"
+                value: heat
+              - dps_val: "2"
+                value: fan_only
+      - id: 2
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 10
+          max: 70
+        mapping:
+          - scale: 2
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 2
+      - id: 5
+        type: boolean
+        name: preset_mode
+        mapping:
+          - dps_val: true
+            value: eco
+          - dps_val: false
+            value: comfort
+      - id: 102
+        type: string
+        name: mode
+        hidden: true
+      - id: 103
+        type: string
+        name: fan_mode
+        mapping:
+          - dps_val: "0"
+            value: auto
+          - dps_val: "1"
+            value: high
+          - dps_val: "2"
+            value: medium
+          - dps_val: "3"
+            value: low
   - entity: lock
     translation_key: child_lock
     category: config

+ 48 - 49
custom_components/tuya_local/devices/beca_bhp6000_thermostat_c.yaml

@@ -1,55 +1,54 @@
 name: Beca BHP-6000 thermostat C
 products:
   - id: drwezxukumr9ohuh
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 35
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: program
-        - dps_val: 2
-          value: temp_override
-        - dps_val: 3
-          value: perm_override
-        - dps_val: 4
-          value: away
-    - id: 5
-      name: hvac_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: cool
-        - dps_val: 2
-          value: heat
-        - dps_val: 3
-          value: "off"
-        - dps_val: 4
-          value: heat_cool
-        - dps_val: 5
-          value: auto
-    - id: 6
-      name: fan_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: auto
-        - dps_val: true
-          value: "on"
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 35
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: program
+          - dps_val: 2
+            value: temp_override
+          - dps_val: 3
+            value: perm_override
+          - dps_val: 4
+            value: away
+      - id: 5
+        name: hvac_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: cool
+          - dps_val: 2
+            value: heat
+          - dps_val: 3
+            value: "off"
+          - dps_val: 4
+            value: heat_cool
+          - dps_val: 5
+            value: auto
+      - id: 6
+        name: fan_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: auto
+          - dps_val: true
+            value: "on"
   - entity: lock
     translation_key: child_lock
     category: config

+ 48 - 49
custom_components/tuya_local/devices/beca_bhp6000_thermostat_f.yaml

@@ -2,55 +2,54 @@ name: Beca BHP-6000 thermostat F
 products:
   - id: drwezxukumr9ohuh
 legacy_type: beca_bhp6000_thermostat
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 2
-      name: temperature
-      type: integer
-      unit: F
-      range:
-        min: 40
-        max: 95
-    - id: 3
-      name: current_temperature
-      type: integer
-    - id: 4
-      name: preset_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: program
-        - dps_val: 2
-          value: temp_override
-        - dps_val: 3
-          value: perm_override
-        - dps_val: 4
-          value: away
-    - id: 5
-      name: hvac_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: cool
-        - dps_val: 2
-          value: heat
-        - dps_val: 3
-          value: "off"
-        - dps_val: 4
-          value: heat_cool
-        - dps_val: 5
-          value: auto
-    - id: 6
-      name: fan_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: auto
-        - dps_val: true
-          value: "on"
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 2
+        name: temperature
+        type: integer
+        unit: F
+        range:
+          min: 40
+          max: 95
+      - id: 3
+        name: current_temperature
+        type: integer
+      - id: 4
+        name: preset_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: program
+          - dps_val: 2
+            value: temp_override
+          - dps_val: 3
+            value: perm_override
+          - dps_val: 4
+            value: away
+      - id: 5
+        name: hvac_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: cool
+          - dps_val: 2
+            value: heat
+          - dps_val: 3
+            value: "off"
+          - dps_val: 4
+            value: heat_cool
+          - dps_val: 5
+            value: auto
+      - id: 6
+        name: fan_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: auto
+          - dps_val: true
+            value: "on"
   - entity: lock
     translation_key: child_lock
     category: config

+ 379 - 380
custom_components/tuya_local/devices/beca_bhp6000_thermostat_mapped.yaml

@@ -1,386 +1,385 @@
 name: Beca BHP-6000 thermostat mapped
 products:
   - id: drwezxukumr9ohuh
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 5
-        max: 35
-        # These mappings are not quite F to C, but appear to be what is used
-        # by the thermostat when set to C (issue #215)
-      mapping:
-        - dps_val: 42
-          value: 5
-          step: 0.5
-        - dps_val: 43
-          value: 5.5
-          step: 0.5
-        - dps_val: 44
-          value: 6
-          step: 0.5
-        - dps_val: 45
-          value: 6.5
-          step: 0.5
-        - dps_val: 46
-          value: 7
-          step: 0.5
-        - dps_val: 47
-          value: 7.5
-          step: 0.5
-        - dps_val: 48
-          value: 8
-          step: 0.5
-        - dps_val: 49
-          value: 8.5
-          step: 0.5
-        - dps_val: 50
-          value: 9
-          step: 0.5
-        - dps_val: 51
-          value: 9.5
-          step: 0.5
-        - dps_val: 52
-          value: 10
-          step: 0.5
-        - dps_val: 53
-          value: 10.5
-          step: 0.5
-        - dps_val: 54
-          value: 11
-          step: 0.5
-        - dps_val: 55
-          value: 11.5
-          step: 0.5
-        - dps_val: 56
-          value: 12
-          step: 0.5
-        - dps_val: 57
-          value: 12.5
-          step: 0.5
-        - dps_val: 58
-          value: 13
-          step: 0.5
-        - dps_val: 59
-          value: 13.5
-          step: 0.5
-        - dps_val: 60
-          value: 14
-          step: 0.5
-        - dps_val: 61
-          value: 14.5
-          step: 0.5
-        - dps_val: 62
-          value: 15
-          step: 0.5
-        - dps_val: 63
-          value: 15.5
-          step: 0.5
-        - dps_val: 64
-          value: 16
-          step: 0.5
-        - dps_val: 65
-          value: 16.5
-          step: 0.5
-        - dps_val: 66
-          value: 17
-          step: 0.5
-        - dps_val: 67
-          value: 17.5
-          step: 0.5
-        - dps_val: 68
-          value: 18
-          step: 0.5
-        - dps_val: 69
-          value: 18.5
-          step: 0.5
-        - dps_val: 70
-          value: 19
-          step: 0.5
-        - dps_val: 71
-          value: 19.5
-          step: 0.5
-        - dps_val: 72
-          value: 20
-          step: 0.5
-        - dps_val: 73
-          value: 20.5
-          step: 0.5
-        - dps_val: 74
-          value: 21
-          step: 0.5
-        - dps_val: 75
-          value: 21.5
-          step: 0.5
-        - dps_val: 76
-          value: 22
-          step: 0.5
-        - dps_val: 77
-          value: 22.50
-          step: 0.5
-        - dps_val: 78
-          value: 23
-          step: 0.5
-        - dps_val: 79
-          value: 23.50
-          step: 0.5
-        - dps_val: 80
-          value: 24
-          step: 0.5
-        - dps_val: 81
-          value: 24.5
-          step: 0.5
-        - dps_val: 82
-          value: 25
-          step: 0.5
-        - dps_val: 83
-          value: 25.5
-          step: 0.5
-        - dps_val: 84
-          value: 26
-          step: 0.5
-        - dps_val: 85
-          value: 26.5
-          step: 0.5
-        - dps_val: 86
-          value: 27
-          step: 0.5
-        - dps_val: 87
-          value: 27.5
-          step: 0.5
-        - dps_val: 88
-          value: 28
-          step: 0.5
-        - dps_val: 89
-          value: 28.5
-          step: 0.5
-        - dps_val: 90
-          value: 29
-          step: 0.5
-        - dps_val: 91
-          value: 29.5
-          step: 0.5
-        - dps_val: 92
-          value: 30
-          step: 0.5
-        - dps_val: 93
-          value: 30.5
-          step: 0.5
-        - dps_val: 94
-          value: 31
-          step: 0.5
-        - dps_val: 95
-          value: 31.5
-          step: 0.5
-        - dps_val: 96
-          value: 32
-          step: 0.5
-        - dps_val: 97
-          value: 32.5
-          step: 0.5
-        - dps_val: 98
-          value: 33
-          step: 0.5
-        - dps_val: 99
-          value: 33.5
-          step: 0.5
-        - dps_val: 100
-          value: 34
-          step: 0.5
-        - dps_val: 101
-          value: 34.5
-          step: 0.5
-        - dps_val: 102
-          value: 35
-          step: 0.5
-    - id: 3
-      name: current_temperature
-      type: integer
-      mapping:
-        - dps_val: 41
-          value: 5
-        - dps_val: 42
-          value: 5.5
-        - dps_val: 43
-          value: 6
-        - dps_val: 44
-          value: 6.5
-        - dps_val: 45
-          value: 7
-        - dps_val: 46
-          value: 7.5
-        - dps_val: 47
-          value: 8
-        - dps_val: 48
-          value: 8.5
-        - dps_val: 49
-          value: 9
-        - dps_val: 50
-          value: 9.5
-        - dps_val: 51
-          value: 10
-        - dps_val: 52
-          value: 10.5
-        - dps_val: 53
-          value: 11
-        - dps_val: 54
-          value: 11.5
-        - dps_val: 55
-          value: 12
-        - dps_val: 56
-          value: 12.5
-        - dps_val: 57
-          value: 13
-        - dps_val: 58
-          value: 13.5
-        - dps_val: 59
-          value: 14
-        - dps_val: 60
-          value: 14.5
-        - dps_val: 61
-          value: 15
-        - dps_val: 62
-          value: 15.5
-        - dps_val: 63
-          value: 16
-        - dps_val: 64
-          value: 16.5
-        - dps_val: 65
-          value: 17
-        - dps_val: 66
-          value: 17.5
-        - dps_val: 67
-          value: 18
-        - dps_val: 68
-          value: 18.5
-        - dps_val: 69
-          value: 19
-        - dps_val: 70
-          value: 19.5
-        - dps_val: 71
-          value: 20
-        - dps_val: 72
-          value: 20.5
-        - dps_val: 73
-          value: 21
-        - dps_val: 74
-          value: 21.5
-        - dps_val: 75
-          value: 22
-        - dps_val: 76
-          value: 22.5
-        - dps_val: 77
-          value: 23
-        - dps_val: 78
-          value: 23.5
-        - dps_val: 79
-          value: 24
-        - dps_val: 80
-          value: 24.5
-        - dps_val: 81
-          value: 25
-        - dps_val: 82
-          value: 25.5
-        - dps_val: 83
-          value: 26
-        - dps_val: 84
-          value: 26.5
-        - dps_val: 85
-          value: 27
-        - dps_val: 86
-          value: 27.5
-        - dps_val: 87
-          value: 28
-        - dps_val: 88
-          value: 28.5
-        - dps_val: 89
-          value: 29
-        - dps_val: 90
-          value: 29.5
-        - dps_val: 91
-          value: 30
-        - dps_val: 92
-          value: 30.5
-        - dps_val: 93
-          value: 31
-        - dps_val: 94
-          value: 31.5
-        - dps_val: 95
-          value: 32
-        - dps_val: 96
-          value: 32.5
-        - dps_val: 97
-          value: 33
-        - dps_val: 98
-          value: 33.5
-        - dps_val: 99
-          value: 34
-        - dps_val: 100
-          value: 34.5
-        - dps_val: 101
-          value: 35
-        - dps_val: 102
-          value: 35.5
-        - dps_val: 103
-          value: 36
-        - dps_val: 104
-          value: 36.5
-        - dps_val: 105
-          value: 37
-        - dps_val: 106
-          value: 37.5
-        - dps_val: 107
-          value: 38
-        - dps_val: 108
-          value: 38.5
-        - dps_val: 109
-          value: 39
-        - dps_val: 110
-          value: 39.5
-        - dps_val: 111
-          value: 40
-        - dps_val: 112
-          value: 40.5
-    - id: 4
-      name: preset_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: program
-        - dps_val: 2
-          value: temp_override
-        - dps_val: 3
-          value: perm_override
-        - dps_val: 4
-          value: away
-    - id: 5
-      name: hvac_mode
-      type: integer
-      mapping:
-        - dps_val: 1
-          value: cool
-        - dps_val: 2
-          value: heat
-        - dps_val: 3
-          value: "off"
-        - dps_val: 4
-          value: heat_cool
-        - dps_val: 5
-          value: auto
-    - id: 6
-      name: fan_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: auto
-        - dps_val: true
-          value: "on"
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 5
+          max: 35
+          # These mappings are not quite F to C, but appear to be what is used
+          # by the thermostat when set to C (issue #215)
+        mapping:
+          - dps_val: 42
+            value: 5
+            step: 0.5
+          - dps_val: 43
+            value: 5.5
+            step: 0.5
+          - dps_val: 44
+            value: 6
+            step: 0.5
+          - dps_val: 45
+            value: 6.5
+            step: 0.5
+          - dps_val: 46
+            value: 7
+            step: 0.5
+          - dps_val: 47
+            value: 7.5
+            step: 0.5
+          - dps_val: 48
+            value: 8
+            step: 0.5
+          - dps_val: 49
+            value: 8.5
+            step: 0.5
+          - dps_val: 50
+            value: 9
+            step: 0.5
+          - dps_val: 51
+            value: 9.5
+            step: 0.5
+          - dps_val: 52
+            value: 10
+            step: 0.5
+          - dps_val: 53
+            value: 10.5
+            step: 0.5
+          - dps_val: 54
+            value: 11
+            step: 0.5
+          - dps_val: 55
+            value: 11.5
+            step: 0.5
+          - dps_val: 56
+            value: 12
+            step: 0.5
+          - dps_val: 57
+            value: 12.5
+            step: 0.5
+          - dps_val: 58
+            value: 13
+            step: 0.5
+          - dps_val: 59
+            value: 13.5
+            step: 0.5
+          - dps_val: 60
+            value: 14
+            step: 0.5
+          - dps_val: 61
+            value: 14.5
+            step: 0.5
+          - dps_val: 62
+            value: 15
+            step: 0.5
+          - dps_val: 63
+            value: 15.5
+            step: 0.5
+          - dps_val: 64
+            value: 16
+            step: 0.5
+          - dps_val: 65
+            value: 16.5
+            step: 0.5
+          - dps_val: 66
+            value: 17
+            step: 0.5
+          - dps_val: 67
+            value: 17.5
+            step: 0.5
+          - dps_val: 68
+            value: 18
+            step: 0.5
+          - dps_val: 69
+            value: 18.5
+            step: 0.5
+          - dps_val: 70
+            value: 19
+            step: 0.5
+          - dps_val: 71
+            value: 19.5
+            step: 0.5
+          - dps_val: 72
+            value: 20
+            step: 0.5
+          - dps_val: 73
+            value: 20.5
+            step: 0.5
+          - dps_val: 74
+            value: 21
+            step: 0.5
+          - dps_val: 75
+            value: 21.5
+            step: 0.5
+          - dps_val: 76
+            value: 22
+            step: 0.5
+          - dps_val: 77
+            value: 22.50
+            step: 0.5
+          - dps_val: 78
+            value: 23
+            step: 0.5
+          - dps_val: 79
+            value: 23.50
+            step: 0.5
+          - dps_val: 80
+            value: 24
+            step: 0.5
+          - dps_val: 81
+            value: 24.5
+            step: 0.5
+          - dps_val: 82
+            value: 25
+            step: 0.5
+          - dps_val: 83
+            value: 25.5
+            step: 0.5
+          - dps_val: 84
+            value: 26
+            step: 0.5
+          - dps_val: 85
+            value: 26.5
+            step: 0.5
+          - dps_val: 86
+            value: 27
+            step: 0.5
+          - dps_val: 87
+            value: 27.5
+            step: 0.5
+          - dps_val: 88
+            value: 28
+            step: 0.5
+          - dps_val: 89
+            value: 28.5
+            step: 0.5
+          - dps_val: 90
+            value: 29
+            step: 0.5
+          - dps_val: 91
+            value: 29.5
+            step: 0.5
+          - dps_val: 92
+            value: 30
+            step: 0.5
+          - dps_val: 93
+            value: 30.5
+            step: 0.5
+          - dps_val: 94
+            value: 31
+            step: 0.5
+          - dps_val: 95
+            value: 31.5
+            step: 0.5
+          - dps_val: 96
+            value: 32
+            step: 0.5
+          - dps_val: 97
+            value: 32.5
+            step: 0.5
+          - dps_val: 98
+            value: 33
+            step: 0.5
+          - dps_val: 99
+            value: 33.5
+            step: 0.5
+          - dps_val: 100
+            value: 34
+            step: 0.5
+          - dps_val: 101
+            value: 34.5
+            step: 0.5
+          - dps_val: 102
+            value: 35
+            step: 0.5
+      - id: 3
+        name: current_temperature
+        type: integer
+        mapping:
+          - dps_val: 41
+            value: 5
+          - dps_val: 42
+            value: 5.5
+          - dps_val: 43
+            value: 6
+          - dps_val: 44
+            value: 6.5
+          - dps_val: 45
+            value: 7
+          - dps_val: 46
+            value: 7.5
+          - dps_val: 47
+            value: 8
+          - dps_val: 48
+            value: 8.5
+          - dps_val: 49
+            value: 9
+          - dps_val: 50
+            value: 9.5
+          - dps_val: 51
+            value: 10
+          - dps_val: 52
+            value: 10.5
+          - dps_val: 53
+            value: 11
+          - dps_val: 54
+            value: 11.5
+          - dps_val: 55
+            value: 12
+          - dps_val: 56
+            value: 12.5
+          - dps_val: 57
+            value: 13
+          - dps_val: 58
+            value: 13.5
+          - dps_val: 59
+            value: 14
+          - dps_val: 60
+            value: 14.5
+          - dps_val: 61
+            value: 15
+          - dps_val: 62
+            value: 15.5
+          - dps_val: 63
+            value: 16
+          - dps_val: 64
+            value: 16.5
+          - dps_val: 65
+            value: 17
+          - dps_val: 66
+            value: 17.5
+          - dps_val: 67
+            value: 18
+          - dps_val: 68
+            value: 18.5
+          - dps_val: 69
+            value: 19
+          - dps_val: 70
+            value: 19.5
+          - dps_val: 71
+            value: 20
+          - dps_val: 72
+            value: 20.5
+          - dps_val: 73
+            value: 21
+          - dps_val: 74
+            value: 21.5
+          - dps_val: 75
+            value: 22
+          - dps_val: 76
+            value: 22.5
+          - dps_val: 77
+            value: 23
+          - dps_val: 78
+            value: 23.5
+          - dps_val: 79
+            value: 24
+          - dps_val: 80
+            value: 24.5
+          - dps_val: 81
+            value: 25
+          - dps_val: 82
+            value: 25.5
+          - dps_val: 83
+            value: 26
+          - dps_val: 84
+            value: 26.5
+          - dps_val: 85
+            value: 27
+          - dps_val: 86
+            value: 27.5
+          - dps_val: 87
+            value: 28
+          - dps_val: 88
+            value: 28.5
+          - dps_val: 89
+            value: 29
+          - dps_val: 90
+            value: 29.5
+          - dps_val: 91
+            value: 30
+          - dps_val: 92
+            value: 30.5
+          - dps_val: 93
+            value: 31
+          - dps_val: 94
+            value: 31.5
+          - dps_val: 95
+            value: 32
+          - dps_val: 96
+            value: 32.5
+          - dps_val: 97
+            value: 33
+          - dps_val: 98
+            value: 33.5
+          - dps_val: 99
+            value: 34
+          - dps_val: 100
+            value: 34.5
+          - dps_val: 101
+            value: 35
+          - dps_val: 102
+            value: 35.5
+          - dps_val: 103
+            value: 36
+          - dps_val: 104
+            value: 36.5
+          - dps_val: 105
+            value: 37
+          - dps_val: 106
+            value: 37.5
+          - dps_val: 107
+            value: 38
+          - dps_val: 108
+            value: 38.5
+          - dps_val: 109
+            value: 39
+          - dps_val: 110
+            value: 39.5
+          - dps_val: 111
+            value: 40
+          - dps_val: 112
+            value: 40.5
+      - id: 4
+        name: preset_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: program
+          - dps_val: 2
+            value: temp_override
+          - dps_val: 3
+            value: perm_override
+          - dps_val: 4
+            value: away
+      - id: 5
+        name: hvac_mode
+        type: integer
+        mapping:
+          - dps_val: 1
+            value: cool
+          - dps_val: 2
+            value: heat
+          - dps_val: 3
+            value: "off"
+          - dps_val: 4
+            value: heat_cool
+          - dps_val: 5
+            value: auto
+      - id: 6
+        name: fan_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: auto
+          - dps_val: true
+            value: "on"
   - entity: lock
     translation_key: child_lock
     category: config

+ 56 - 57
custom_components/tuya_local/devices/beca_bht002_thermostat_c.yaml

@@ -3,63 +3,62 @@ legacy_type: beca_bht6000_thermostat_c
 products:
   - id: IAYz2WK1th0cMLmL
     name: Beca BHT-002 / MJZM 16A-3000BH
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: "0"
-              value: auto
-            - dps_val: "1"
-              value: heat
-            - dps_val: null
-              value: heat
-              hidden: true
-    - id: 2
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 10
-        max: 70
-      mapping:
-        - scale: 2
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 2
-    - id: 4
-      type: string
-      name: mode
-      optional: true
-      hidden: true
-    - id: 5
-      type: boolean
-      name: preset_mode
-      mapping:
-        - dps_val: true
-          value: eco
-        - dps_val: false
-          value: comfort
-    - id: 103
-      type: string
-      # There are many variants of BHT-002 on the market, not all support this
-      optional: true
-      name: hvac_action
-      mapping:
-        - dps_val: "0"
-          value: idle
-        - dps_val: "1"
-          value: heating
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: "0"
+                value: auto
+              - dps_val: "1"
+                value: heat
+              - dps_val: null
+                value: heat
+                hidden: true
+      - id: 2
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 10
+          max: 70
+        mapping:
+          - scale: 2
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 2
+      - id: 4
+        type: string
+        name: mode
+        optional: true
+        hidden: true
+      - id: 5
+        type: boolean
+        name: preset_mode
+        mapping:
+          - dps_val: true
+            value: eco
+          - dps_val: false
+            value: comfort
+      - id: 103
+        type: string
+        # There are many variants of BHT-002 on the market, not all support this
+        optional: true
+        name: hvac_action
+        mapping:
+          - dps_val: "0"
+            value: idle
+          - dps_val: "1"
+            value: heating
   - entity: lock
     translation_key: child_lock
     category: config

+ 83 - 84
custom_components/tuya_local/devices/beca_bht006_thermostat_c.yaml

@@ -2,90 +2,89 @@ name: Thermostat
 products:
   - id: 7jzdtn4pwujmtskd
     name: Beca BAC-006 fancoil
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: "cold"
-              value: cool
-            - dps_val: "hot"
-              value: heat
-            - dps_val: "wind"
-              value: fan_only
-    - id: 2
-      type: string
-      name: mode
-      optional: true
-      hidden: true
-    - id: 4
-      type: boolean
-      name: preset_mode
-      mapping:
-        - dps_val: true
-          value: "eco"
-        - dps_val: false
-          value: "none"
-    - id: 16
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 50
-        max: 350
-      mapping:
-        - scale: 10
-          step: 5
-    - id: 19
-      type: integer
-      name: max_temperature
-      mapping:
-        - scale: 10
-    - id: 26
-      type: integer
-      name: min_temperature
-      mapping:
-        - scale: 10
-    - id: 24
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 36
-      type: string
-      name: hvac_action
-      mapping:
-        - dps_val: close
-          value: idle
-        - dps_val: open
-          constraint: mode
-          conditions:
-            - dps_val: hot
-              value: heating
-            - dps_val: cold
-              value: cooling
-            - dps_val: wind
-              value: fan
-    - id: 28
-      type: string
-      name: fan_mode
-      mapping:
-        - dps_val: auto
-          value: auto
-        - dps_val: low
-          value: low
-        - dps_val: middle
-          value: medium
-        - dps_val: high
-          value: high
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: "cold"
+                value: cool
+              - dps_val: "hot"
+                value: heat
+              - dps_val: "wind"
+                value: fan_only
+      - id: 2
+        type: string
+        name: mode
+        optional: true
+        hidden: true
+      - id: 4
+        type: boolean
+        name: preset_mode
+        mapping:
+          - dps_val: true
+            value: "eco"
+          - dps_val: false
+            value: "none"
+      - id: 16
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 50
+          max: 350
+        mapping:
+          - scale: 10
+            step: 5
+      - id: 19
+        type: integer
+        name: max_temperature
+        mapping:
+          - scale: 10
+      - id: 26
+        type: integer
+        name: min_temperature
+        mapping:
+          - scale: 10
+      - id: 24
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 36
+        type: string
+        name: hvac_action
+        mapping:
+          - dps_val: close
+            value: idle
+          - dps_val: open
+            constraint: mode
+            conditions:
+              - dps_val: hot
+                value: heating
+              - dps_val: cold
+                value: cooling
+              - dps_val: wind
+                value: fan
+      - id: 28
+        type: string
+        name: fan_mode
+        mapping:
+          - dps_val: auto
+            value: auto
+          - dps_val: low
+            value: low
+          - dps_val: middle
+            value: medium
+          - dps_val: high
+            value: high
   - entity: lock
     translation_key: child_lock
     category: config

+ 31 - 33
custom_components/tuya_local/devices/beca_zht002_thermostat_c.yaml

@@ -2,39 +2,37 @@ name: Thermostat
 products:
   - id: aoclfnxz
     name: MOES Zigbee Thermostat
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: "heat"
-    - id: 16
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 1
-        max: 45
-    - id: 24
-      name: current_temperature
-      type: integer
-      mapping:
-        - scale: 10
-    - id: 36
-      name: hvac_action
-      type: string
-      mapping:
-        - dps_val: open
-          value: heating
-        - dps_val: close
-          value: idle
-
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: "heat"
+      - id: 16
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 1
+          max: 45
+      - id: 24
+        name: current_temperature
+        type: integer
+        mapping:
+          - scale: 10
+      - id: 36
+        name: hvac_action
+        type: string
+        mapping:
+          - dps_val: open
+            value: heating
+          - dps_val: close
+            value: idle
   - entity: lock
     translation_key: child_lock
     category: config

+ 88 - 89
custom_components/tuya_local/devices/becool_heatpump.yaml

@@ -1,93 +1,92 @@
 name: Be Cool BC14KL2101F
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          value: fan_only
-          constraint: mode
-          conditions:
-            - dps_val: "0"
-              value: heat_cool
-            - dps_val: "1"
-              value: fan_only
-            - dps_val: "2"
-              value: dry
-            - dps_val: "3"
-              value: cool
-            - dps_val: "5"
-              value: heat
-    - id: 4
-      type: integer
-      name: unknown_4
-    - id: 5
-      type: string
-      name: mode
-      hidden: true
-    - id: 6
-      type: integer
-      name: temperature
-      range:
-        min: 13
-        max: 32
-      mapping:
-        - constraint: temperature_unit
-          conditions:
-            - dps_val: true
-              value_redirect: temp_set_f
-              range:
-                min: 55
-                max: 90
-    - id: 8
-      type: string
-      name: fan_mode
-      mapping:
-        - dps_val: "1"
-          value: low
-        - dps_val: "2"
-          value: medium
-        - dps_val: "3"
-          value: high
-    - id: 10
-      type: boolean
-      name: temperature_unit
-      mapping:
-        - dps_val: false
-          value: C
-        - dps_val: true
-          value: F
-    - id: 13
-      type: integer
-      name: unknown_13
-    - id: 14
-      type: integer
-      name: unknown_14
-    - id: 15
-      type: integer
-      name: unknown_15
-    - id: 16
-      type: boolean
-      name: unknown_16
-    - id: 17
-      type: boolean
-      name: unknown_17
-    - id: 18
-      name: temp_set_f
-      type: integer
-      range:
-        min: 55
-        max: 90
-      hidden: true
-      optional: true
-    - id: 19
-      type: boolean
-      name: unknown_19
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            value: fan_only
+            constraint: mode
+            conditions:
+              - dps_val: "0"
+                value: heat_cool
+              - dps_val: "1"
+                value: fan_only
+              - dps_val: "2"
+                value: dry
+              - dps_val: "3"
+                value: cool
+              - dps_val: "5"
+                value: heat
+      - id: 4
+        type: integer
+        name: unknown_4
+      - id: 5
+        type: string
+        name: mode
+        hidden: true
+      - id: 6
+        type: integer
+        name: temperature
+        range:
+          min: 13
+          max: 32
+        mapping:
+          - constraint: temperature_unit
+            conditions:
+              - dps_val: true
+                value_redirect: temp_set_f
+                range:
+                  min: 55
+                  max: 90
+      - id: 8
+        type: string
+        name: fan_mode
+        mapping:
+          - dps_val: "1"
+            value: low
+          - dps_val: "2"
+            value: medium
+          - dps_val: "3"
+            value: high
+      - id: 10
+        type: boolean
+        name: temperature_unit
+        mapping:
+          - dps_val: false
+            value: C
+          - dps_val: true
+            value: F
+      - id: 13
+        type: integer
+        name: unknown_13
+      - id: 14
+        type: integer
+        name: unknown_14
+      - id: 15
+        type: integer
+        name: unknown_15
+      - id: 16
+        type: boolean
+        name: unknown_16
+      - id: 17
+        type: boolean
+        name: unknown_17
+      - id: 18
+        name: temp_set_f
+        type: integer
+        range:
+          min: 55
+          max: 90
+        hidden: true
+        optional: true
+      - id: 19
+        type: boolean
+        name: unknown_19
   - entity: select
     category: config
     translation_key: temperature_unit

+ 30 - 31
custom_components/tuya_local/devices/benexmart_blind_motor.yaml

@@ -1,35 +1,34 @@
 name: benexmart blind motor
-primary_entity:
-  entity: cover
-  class: blind
-  dps:
-    - id: 1
-      name: control
-      type: string
-      mapping:
-        - dps_val: open
-          value: open
-        - dps_val: close
-          value: close
-        - dps_val: stop
-          value: stop
-    - id: 2
-      name: position
-      type: integer
-      range:
-        min: 0
-        max: 100
-      mapping:
-        - invert: true
-    - id: 2
-      name: current_position
-      type: integer
-      range:
-        min: 0
-        max: 100
-      mapping:
-        - invert: true
-secondary_entities:
+entities:
+  - entity: cover
+    class: blind
+    dps:
+      - id: 1
+        name: control
+        type: string
+        mapping:
+          - dps_val: open
+            value: open
+          - dps_val: close
+            value: close
+          - dps_val: stop
+            value: stop
+      - id: 2
+        name: position
+        type: integer
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - invert: true
+      - id: 2
+        name: current_position
+        type: integer
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - invert: true
   - entity: switch
     category: config
     name: Reversed

+ 50 - 51
custom_components/tuya_local/devices/beok_tcb38_thermostat.yaml

@@ -1,56 +1,55 @@
 name: Thermostat
 # rebadged as RT-70
-primary_entity:
-  entity: climate
-  translation_key: thermostat
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: manual
-              value: heat
-            - dps_val: auto
-              value: auto
-    - id: 2
-      type: integer
-      name: temperature
-      range:
-        min: 50
-        max: 990
-      mapping:
-        - scale: 10
-          step: 5
-      unit: C
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 4
-      type: string
-      name: mode
-      hidden: true
-    - id: 21
-      type: integer
-      name: max_temperature
-    - id: 22
-      type: integer
-      name: min_temperature
-    - id: 35
-      type: string
-      name: hvac_action
-      mapping:
-        - dps_val: open
-          value: heating
-        - dps_val: close
-          value: idle
-secondary_entities:
+entities:
+  - entity: climate
+    translation_key: thermostat
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: manual
+                value: heat
+              - dps_val: auto
+                value: auto
+      - id: 2
+        type: integer
+        name: temperature
+        range:
+          min: 50
+          max: 990
+        mapping:
+          - scale: 10
+            step: 5
+        unit: C
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 4
+        type: string
+        name: mode
+        hidden: true
+      - id: 21
+        type: integer
+        name: max_temperature
+      - id: 22
+        type: integer
+        name: min_temperature
+      - id: 35
+        type: string
+        name: hvac_action
+        mapping:
+          - dps_val: open
+            value: heating
+          - dps_val: close
+            value: idle
   - entity: lock
     translation_key: child_lock
     category: config

+ 61 - 62
custom_components/tuya_local/devices/beok_tgm50_thermostat.yaml

@@ -2,68 +2,67 @@ name: Thermostat
 products:
   - id: m3j5wouhgsvjlma9
     name: Beok TGM50-WIFI-WP
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          constraint: preset_mode
-          conditions:
-            - dps_val: auto
-              value: auto
-            - dps_val: temporary
-              value: auto
-              hidden: true
-            - dps_val: home
-              value: heat
-            - dps_val: leave
-              value: heat
-              hidden: true
-        - dps_val: false
-          value: "off"
-    - id: 2
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 50
-        max: 300
-      mapping:
-        - scale: 10
-          step: 5
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 4
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: leave
-          value: away
-        - dps_val: home
-          value: manual
-        - dps_val: auto
-          value: program
-        - dps_val: temporary
-          value: temp_override
-    - id: 5
-      type: string
-      name: hvac_action
-      mapping:
-        - dps_val: "0"
-          value: idle
-        - dps_val: "1"
-          value: heating
-    - id: 15
-      name: max_temperature
-      type: integer
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            constraint: preset_mode
+            conditions:
+              - dps_val: auto
+                value: auto
+              - dps_val: temporary
+                value: auto
+                hidden: true
+              - dps_val: home
+                value: heat
+              - dps_val: leave
+                value: heat
+                hidden: true
+          - dps_val: false
+            value: "off"
+      - id: 2
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 50
+          max: 300
+        mapping:
+          - scale: 10
+            step: 5
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 4
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: leave
+            value: away
+          - dps_val: home
+            value: manual
+          - dps_val: auto
+            value: program
+          - dps_val: temporary
+            value: temp_override
+      - id: 5
+        type: string
+        name: hvac_action
+        mapping:
+          - dps_val: "0"
+            value: idle
+          - dps_val: "1"
+            value: heating
+      - id: 15
+        name: max_temperature
+        type: integer
   - entity: lock
     translation_key: child_lock
     category: config

+ 56 - 57
custom_components/tuya_local/devices/beok_tgr81_thermostat_c.yaml

@@ -5,63 +5,62 @@ products:
     name: Avatto WT200W-EH
   - id: gogb05wrtredz3bs
     name: Avatto ME81
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: true
-          constraint: preset_mode
-          conditions:
-            - dps_val: auto
-              value: auto
-            - dps_val: manual
-              value: heat
-        - dps_val: false
-          value: "off"
-    - id: 2
-      # Deprecated: use hvac_mode to select between these
-      # left as preset_mode for now to avoid breaking things
-      name: preset_mode
-      type: string
-      mapping:
-        - dps_val: auto
-          value: program
-        - dps_val: manual
-          value: manual
-    - id: 16
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 5
-        max: 90
-    - id: 19
-      type: integer
-      optional: true
-      name: max_temperature
-    - id: 24
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 26
-      optional: true
-      type: integer
-      name: min_temperature
-    - id: 36
-      type: string
-      name: hvac_action
-      optional: true
-      mapping:
-        - dps_val: close
-          value: idle
-        - dps_val: open
-          value: heating
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: true
+            constraint: preset_mode
+            conditions:
+              - dps_val: auto
+                value: auto
+              - dps_val: manual
+                value: heat
+          - dps_val: false
+            value: "off"
+      - id: 2
+        # Deprecated: use hvac_mode to select between these
+        # left as preset_mode for now to avoid breaking things
+        name: preset_mode
+        type: string
+        mapping:
+          - dps_val: auto
+            value: program
+          - dps_val: manual
+            value: manual
+      - id: 16
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 5
+          max: 90
+      - id: 19
+        type: integer
+        optional: true
+        name: max_temperature
+      - id: 24
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 26
+        optional: true
+        type: integer
+        name: min_temperature
+      - id: 36
+        type: string
+        name: hvac_action
+        optional: true
+        mapping:
+          - dps_val: close
+            value: idle
+          - dps_val: open
+            value: heating
   - entity: number
     name: Temperature calibration
     category: config

+ 53 - 54
custom_components/tuya_local/devices/beok_tol47_thermostat.yaml

@@ -1,58 +1,57 @@
 name: Beok TOL47 thermostat
-primary_entity:
-  entity: climate
-  translation_only_key: thermostat
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: preset_mode
-          conditions:
-            - dps_val: cold
-              value: heat
-            - dps_val: hot
-              value: auto
-            - dps_val: wind
-              value: auto
-    - id: 2
-      type: integer
-      name: temperature
-      unit: C
-      mapping:
-        - scale: 10
-          step: 5
-      range:
-        min: 50
-        max: 950
-    - id: 3
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 4
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: cold
-          value: manual
-        - dps_val: hot
-          value: program
-        - dps_val: wind
-          value: temp_override
-          hidden: true
-    - id: 5
-      type: string
-      name: hvac_action
-      mapping:
-        - dps_val: "0"
-          value: idle
-        - dps_val: "1"
-          value: heating
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: thermostat
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: preset_mode
+            conditions:
+              - dps_val: cold
+                value: heat
+              - dps_val: hot
+                value: auto
+              - dps_val: wind
+                value: auto
+      - id: 2
+        type: integer
+        name: temperature
+        unit: C
+        mapping:
+          - scale: 10
+            step: 5
+        range:
+          min: 50
+          max: 950
+      - id: 3
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 4
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: cold
+            value: manual
+          - dps_val: hot
+            value: program
+          - dps_val: wind
+            value: temp_override
+            hidden: true
+      - id: 5
+        type: string
+        name: hvac_action
+        mapping:
+          - dps_val: "0"
+            value: idle
+          - dps_val: "1"
+            value: heating
   - entity: lock
     translation_key: child_lock
     category: config

+ 116 - 117
custom_components/tuya_local/devices/beok_tr8b_thermostat.yaml

@@ -1,121 +1,120 @@
 name: Beok TR8B thermostat
-primary_entity:
-  entity: climate
-  translation_only_key: combo_floor
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: preset_mode
-          conditions:
-            - dps_val: cool
-              value: cool
-            - dps_val: ventil
-              value: fan_only
-            - dps_val: heat
-              value: heat
-            - dps_val: floor
-              value: cool
-            - dps_val: floor_heat
-              value: heat
-    - id: 2
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: cool
-          value: cool
-        - dps_val: ventil
-          value: fan_only
-        - dps_val: heat
-          value: heat
-        - dps_val: floor
-          value: floor_cool
-        - dps_val: floor_heat
-          value: floor_heat
-    - id: 16
-      type: integer
-      name: temperature
-      range:
-        min: 50
-        max: 2000
-      mapping:
-        - scale: 10
-          step: 5
-          constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              step: 10
-    - id: 19
-      type: integer
-      name: max_temperature
-      mapping:
-        - scale: 10
-    - id: 23
-      type: string
-      name: temperature_unit
-      mapping:
-        - dps_val: c
-          value: C
-        - dps_val: f
-          value: F
-    - id: 24
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 26
-      type: integer
-      name: min_temperature
-      mapping:
-        - scale: 10
-    - id: 28
-      type: string
-      name: fan_mode
-      mapping:
-        - dps_val: auto
-          value: auto
-        - dps_val: low
-          value: low
-        - dps_val: middle
-          value: medium
-        - dps_val: high
-          value: high
-    - id: 36
-      type: string
-      name: hvac_action
-      mapping:
-        - dps_val: open
-          value: idle
-          constraint: preset_mode
-          conditions:
-            - dps_val: [cool, floor]
-              value: cooling
-            - dps_val: [heat, floor_heat]
-              value: heating
-        - dps_val: close
-          value: idle
-    - id: 101
-      type: bitfield
-      name: features
-    - id: 102
-      type: integer
-      name: temperature_step
-      mapping:
-        - scale: 10
-    - id: 104
-      type: bitfield
-      name: valid_modes
-    - id: 105
-      type: string
-      name: model
-    - id: 106
-      type: string
-      name: light_mode
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: combo_floor
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: preset_mode
+            conditions:
+              - dps_val: cool
+                value: cool
+              - dps_val: ventil
+                value: fan_only
+              - dps_val: heat
+                value: heat
+              - dps_val: floor
+                value: cool
+              - dps_val: floor_heat
+                value: heat
+      - id: 2
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: cool
+            value: cool
+          - dps_val: ventil
+            value: fan_only
+          - dps_val: heat
+            value: heat
+          - dps_val: floor
+            value: floor_cool
+          - dps_val: floor_heat
+            value: floor_heat
+      - id: 16
+        type: integer
+        name: temperature
+        range:
+          min: 50
+          max: 2000
+        mapping:
+          - scale: 10
+            step: 5
+            constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                step: 10
+      - id: 19
+        type: integer
+        name: max_temperature
+        mapping:
+          - scale: 10
+      - id: 23
+        type: string
+        name: temperature_unit
+        mapping:
+          - dps_val: c
+            value: C
+          - dps_val: f
+            value: F
+      - id: 24
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 26
+        type: integer
+        name: min_temperature
+        mapping:
+          - scale: 10
+      - id: 28
+        type: string
+        name: fan_mode
+        mapping:
+          - dps_val: auto
+            value: auto
+          - dps_val: low
+            value: low
+          - dps_val: middle
+            value: medium
+          - dps_val: high
+            value: high
+      - id: 36
+        type: string
+        name: hvac_action
+        mapping:
+          - dps_val: open
+            value: idle
+            constraint: preset_mode
+            conditions:
+              - dps_val: [cool, floor]
+                value: cooling
+              - dps_val: [heat, floor_heat]
+                value: heating
+          - dps_val: close
+            value: idle
+      - id: 101
+        type: bitfield
+        name: features
+      - id: 102
+        type: integer
+        name: temperature_step
+        mapping:
+          - scale: 10
+      - id: 104
+        type: bitfield
+        name: valid_modes
+      - id: 105
+        type: string
+        name: model
+      - id: 106
+        type: string
+        name: light_mode
   - entity: switch
     translation_key: anti_frost
     category: config

+ 62 - 63
custom_components/tuya_local/devices/beok_tr9b_thermostat.yaml

@@ -1,67 +1,66 @@
 name: Beok TR9B thermostat
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: auto
-              value: auto
-            - dps_val: manual
-              value: heat
-    - id: 2
-      type: string
-      name: mode
-      hidden: true
-    - id: 16
-      type: integer
-      name: temperature
-      range:
-        min: 50
-        max: 10000
-      mapping:
-        - scale: 10
-          step: 5
-          constraint: temperature_unit
-          conditions:
-            - dps_val: f
-              step: 10
-    - id: 19
-      type: integer
-      name: max_temperature
-      mapping:
-        - scale: 10
-    - id: 23
-      type: string
-      name: temperature_unit
-      mapping:
-        - dps_val: c
-          value: C
-        - dps_val: f
-          value: F
-    - id: 24
-      type: integer
-      name: current_temperature
-      mapping:
-        - scale: 10
-    - id: 26
-      type: integer
-      name: min_temperature
-      mapping:
-        - scale: 10
-    - id: 101
-      type: integer
-      name: unknown_101
-    - id: 102
-      type: integer
-      name: unknown_102
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: auto
+                value: auto
+              - dps_val: manual
+                value: heat
+      - id: 2
+        type: string
+        name: mode
+        hidden: true
+      - id: 16
+        type: integer
+        name: temperature
+        range:
+          min: 50
+          max: 10000
+        mapping:
+          - scale: 10
+            step: 5
+            constraint: temperature_unit
+            conditions:
+              - dps_val: f
+                step: 10
+      - id: 19
+        type: integer
+        name: max_temperature
+        mapping:
+          - scale: 10
+      - id: 23
+        type: string
+        name: temperature_unit
+        mapping:
+          - dps_val: c
+            value: C
+          - dps_val: f
+            value: F
+      - id: 24
+        type: integer
+        name: current_temperature
+        mapping:
+          - scale: 10
+      - id: 26
+        type: integer
+        name: min_temperature
+        mapping:
+          - scale: 10
+      - id: 101
+        type: integer
+        name: unknown_101
+      - id: 102
+        type: integer
+        name: unknown_102
   - entity: switch
     translation_key: anti_frost
     category: config

+ 37 - 38
custom_components/tuya_local/devices/betterlife_bl1500_heater.yaml

@@ -1,44 +1,43 @@
 name: Betterlife BL1500 heater
 products:
   - id: ptiFKEk2bgAslxOA
-primary_entity:
-  entity: climate
-  translation_only_key: heater
-  dps:
-    - id: 1
-      type: boolean
-      name: hvac_mode
-      mapping:
-        - dps_val: true
-          value: heat
-        - dps_val: false
-          value: "off"
-    - id: 2
-      type: integer
-      name: temperature
-      unit: C
-      range:
-        min: 15
-        max: 30
-      mapping:
-        - constraint: preset_mode
-          conditions:
-            - dps_val: "2"
-              value: 20
-              range:
-                min: 20
-                max: 20
-    - id: 4
-      type: string
-      name: preset_mode
-      mapping:
-        - dps_val: "0"
-          value: comfort
-        - dps_val: "1"
-          value: boost
-        - dps_val: "2"
-          value: eco
-secondary_entities:
+entities:
+  - entity: climate
+    translation_only_key: heater
+    dps:
+      - id: 1
+        type: boolean
+        name: hvac_mode
+        mapping:
+          - dps_val: true
+            value: heat
+          - dps_val: false
+            value: "off"
+      - id: 2
+        type: integer
+        name: temperature
+        unit: C
+        range:
+          min: 15
+          max: 30
+        mapping:
+          - constraint: preset_mode
+            conditions:
+              - dps_val: "2"
+                value: 20
+                range:
+                  min: 20
+                  max: 20
+      - id: 4
+        type: string
+        name: preset_mode
+        mapping:
+          - dps_val: "0"
+            value: comfort
+          - dps_val: "1"
+            value: boost
+          - dps_val: "2"
+            value: eco
   - entity: lock
     translation_key: child_lock
     category: config

+ 50 - 51
custom_components/tuya_local/devices/bht002_galw_thermostat.yaml

@@ -1,55 +1,54 @@
 name: Thermostat
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: manual
-              value: heat
-            - dps_val: program
-              value: auto
-    - id: 2
-      name: mode
-      type: string
-    - id: 3
-      name: hvac_action
-      type: boolean
-      optional: true
-      mapping:
-        - dps_val: false
-          value: idle
-        - dps_val: true
-          value: heating
-        - dps_val: null
-          value: idle
-    - id: 16
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 50
-        max: 950
-      mapping:
-        - scale: 10
-          step: 5
-    - id: 19
-      name: max_temperature
-      type: integer
-      mapping:
-        - scale: 10
-    - id: 24
-      name: current_temperature
-      type: integer
-      mapping:
-        - scale: 10
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: manual
+                value: heat
+              - dps_val: program
+                value: auto
+      - id: 2
+        name: mode
+        type: string
+      - id: 3
+        name: hvac_action
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: false
+            value: idle
+          - dps_val: true
+            value: heating
+          - dps_val: null
+            value: idle
+      - id: 16
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 50
+          max: 950
+        mapping:
+          - scale: 10
+            step: 5
+      - id: 19
+        name: max_temperature
+        type: integer
+        mapping:
+          - scale: 10
+      - id: 24
+        name: current_temperature
+        type: integer
+        mapping:
+          - scale: 10
   - entity: button
     translation_key: factory_reset
     category: config

+ 54 - 55
custom_components/tuya_local/devices/bht002_gblw_thermostat.yaml

@@ -2,61 +2,60 @@ name: Thermostat
 products:
   - id: v5214objiaepcaer
     name: BHT-002 GBLW
-primary_entity:
-  entity: climate
-  dps:
-    - id: 1
-      name: hvac_mode
-      type: boolean
-      mapping:
-        - dps_val: false
-          value: "off"
-        - dps_val: true
-          constraint: mode
-          conditions:
-            - dps_val: manual
-              value: heat
-            - dps_val: program
-              value: auto
-    - id: 2
-      name: mode
-      type: string
-    - id: 3
-      name: hvac_action
-      type: string
-      optional: true
-      mapping:
-        - dps_val: Warming
-          value: heating
-        - dps_val: Heat
-          value: heating
-        - dps_val: "Off"
-          value: idle
-        - dps_val: Closed
-          value: idle
-        - dps_val: null
-          value: idle
-    - id: 16
-      name: temperature
-      type: integer
-      unit: C
-      range:
-        min: 50
-        max: 950
-      mapping:
-        - scale: 10
-          step: 5
-    - id: 19
-      name: max_temperature
-      type: integer
-      mapping:
-        - scale: 10
-    - id: 24
-      name: current_temperature
-      type: integer
-      mapping:
-        - scale: 10
-secondary_entities:
+entities:
+  - entity: climate
+    dps:
+      - id: 1
+        name: hvac_mode
+        type: boolean
+        mapping:
+          - dps_val: false
+            value: "off"
+          - dps_val: true
+            constraint: mode
+            conditions:
+              - dps_val: manual
+                value: heat
+              - dps_val: program
+                value: auto
+      - id: 2
+        name: mode
+        type: string
+      - id: 3
+        name: hvac_action
+        type: string
+        optional: true
+        mapping:
+          - dps_val: Warming
+            value: heating
+          - dps_val: Heat
+            value: heating
+          - dps_val: "Off"
+            value: idle
+          - dps_val: Closed
+            value: idle
+          - dps_val: null
+            value: idle
+      - id: 16
+        name: temperature
+        type: integer
+        unit: C
+        range:
+          min: 50
+          max: 950
+        mapping:
+          - scale: 10
+            step: 5
+      - id: 19
+        name: max_temperature
+        type: integer
+        mapping:
+          - scale: 10
+      - id: 24
+        name: current_temperature
+        type: integer
+        mapping:
+          - scale: 10
   - entity: button
     translation_key: factory_reset
     category: config

+ 6 - 7
custom_components/tuya_local/devices/ble_adaprox_fingerbot.yaml

@@ -1,13 +1,12 @@
 name: BLE ADAPROX Fingerbot
 products:
   - id: yiihr7zh
-primary_entity:
-  entity: switch
-  dps:
-    - id: 2
-      type: boolean
-      name: switch
-secondary_entities:
+entities:
+  - entity: switch
+    dps:
+      - id: 2
+        type: boolean
+        name: switch
   - entity: sensor
     class: battery
     category: diagnostic

+ 46 - 47
custom_components/tuya_local/devices/ble_hct611_watertimer.yaml

@@ -2,53 +2,52 @@ name: Water timer
 products:
   - id: tqzkwarw
     name: HCT-611
-primary_entity:
-  entity: valve
-  class: water
-  dps:
-    - id: 1
-      type: boolean
-      name: valve
-    - id: 12
-      type: string
-      name: state
-      optional: true
-    - id: 110
-      type: boolean
-      name: switch_record
-    - id: 101
-      type: base64
-      name: program_1
-      optional: true
-    - id: 102
-      type: base64
-      name: program_2
-      optional: true
-    - id: 103
-      type: base64
-      name: program_3
-      optional: true
-    - id: 104
-      type: base64
-      name: program_4
-      optional: true
-    - id: 105
-      type: base64
-      name: program_5
-      optional: true
-    - id: 106
-      type: base64
-      name: program_6
-      optional: true
-    - id: 107
-      type: base64
-      name: program_7
-      optional: true
-    - id: 108
-      type: base64
-      name: program_8
-      optional: true
-secondary_entities:
+entities:
+  - entity: valve
+    class: water
+    dps:
+      - id: 1
+        type: boolean
+        name: valve
+      - id: 12
+        type: string
+        name: state
+        optional: true
+      - id: 110
+        type: boolean
+        name: switch_record
+      - id: 101
+        type: base64
+        name: program_1
+        optional: true
+      - id: 102
+        type: base64
+        name: program_2
+        optional: true
+      - id: 103
+        type: base64
+        name: program_3
+        optional: true
+      - id: 104
+        type: base64
+        name: program_4
+        optional: true
+      - id: 105
+        type: base64
+        name: program_5
+        optional: true
+      - id: 106
+        type: base64
+        name: program_6
+        optional: true
+      - id: 107
+        type: base64
+        name: program_7
+        optional: true
+      - id: 108
+        type: base64
+        name: program_8
+        optional: true
   - entity: switch
     icon: "mdi:pipe-valve"
     deprecated: valve

+ 50 - 51
custom_components/tuya_local/devices/ble_hu06_lock.yaml

@@ -4,57 +4,56 @@ products:
     name: HU06
   - id: xicdxood
     name: Impression ImSmart C502
-primary_entity:
-  entity: lock
-  dps:
-    - id: 13
-      name: unlock_password
-      type: integer
-      optional: true
-      persist: false
-    - id: 16
-      name: unlock_key
-      type: integer
-      optional: true
-      persist: false
-    - id: 19
-      name: unlock_ble
-      type: integer
-      optional: true
-      persist: false
-    - id: 21
-      name: jammed
-      type: string
-      optional: true
-      persist: false
-      mapping:
-        - dps_val: tongue_bad
-          value: true
-        - value: false
-    - id: 43
-      name: unlock_fingerprint
-      type: integer
-      optional: true
-      persist: false
-    - id: 47
-      name: lock
-      type: boolean
-      readonly: true
-    - id: 62
-      name: unlock_app
-      type: integer
-      optional: true
-      persist: false
-    - id: 63
-      name: unlock_voice
-      type: integer
-      optional: true
-      persist: false
-    - id: 105
-      name: lock_record
-      type: string
-      optional: true
-secondary_entities:
+entities:
+  - entity: lock
+    dps:
+      - id: 13
+        name: unlock_password
+        type: integer
+        optional: true
+        persist: false
+      - id: 16
+        name: unlock_key
+        type: integer
+        optional: true
+        persist: false
+      - id: 19
+        name: unlock_ble
+        type: integer
+        optional: true
+        persist: false
+      - id: 21
+        name: jammed
+        type: string
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: tongue_bad
+            value: true
+          - value: false
+      - id: 43
+        name: unlock_fingerprint
+        type: integer
+        optional: true
+        persist: false
+      - id: 47
+        name: lock
+        type: boolean
+        readonly: true
+      - id: 62
+        name: unlock_app
+        type: integer
+        optional: true
+        persist: false
+      - id: 63
+        name: unlock_voice
+        type: integer
+        optional: true
+        persist: false
+      - id: 105
+        name: lock_record
+        type: string
+        optional: true
   - entity: sensor
     class: battery
     category: diagnostic

+ 30 - 31
custom_components/tuya_local/devices/ble_orion_lock.yaml

@@ -2,37 +2,36 @@ name: Orion BLE lock
 products:
   - id: a6nttc41
     name: Orion DL021HA
-primary_entity:
-  entity: lock
-  dps:
-    - id: 1
-      type: string
-      name: unlock_method_register
-      optional: true
-      sensitive: true
-    - id: 2
-      type: string
-      name: unlock_method_delete
-      optional: true
-    - id: 12
-      type: integer
-      name: unlock_fingerprint
-      persist: false
-      optional: true
-    - id: 19
-      type: integer
-      name: unlock_app
-      persist: false
-      optional: true
-    - id: 33
-      type: boolean
-      name: lock
-    - id: 54
-      type: string
-      name: sync_method
-      optional: true
-      sensitive: true
-secondary_entities:
+entities:
+  - entity: lock
+    dps:
+      - id: 1
+        type: string
+        name: unlock_method_register
+        optional: true
+        sensitive: true
+      - id: 2
+        type: string
+        name: unlock_method_delete
+        optional: true
+      - id: 12
+        type: integer
+        name: unlock_fingerprint
+        persist: false
+        optional: true
+      - id: 19
+        type: integer
+        name: unlock_app
+        persist: false
+        optional: true
+      - id: 33
+        type: boolean
+        name: lock
+      - id: 54
+        type: string
+        name: sync_method
+        optional: true
+        sensitive: true
   - entity: sensor
     class: battery
     category: diagnostic

+ 11 - 12
custom_components/tuya_local/devices/ble_pt216_temp_humidity.yaml

@@ -2,18 +2,17 @@ name: Temperature and humidity sensor
 products:
   - id: 04nb6kdt
     name: PT216 / PT19DB-2
-primary_entity:
-  entity: sensor
-  class: temperature
-  dps:
-    - id: 1
-      type: integer
-      name: sensor
-      unit: C
-      class: measurement
-      mapping:
-        - scale: 10
-secondary_entities:
+entities:
+  - entity: sensor
+    class: temperature
+    dps:
+      - id: 1
+        type: integer
+        name: sensor
+        unit: C
+        class: measurement
+        mapping:
+          - scale: 10
   - entity: sensor
     class: humidity
     dps:

+ 61 - 62
custom_components/tuya_local/devices/ble_pulido_p13_lock.yaml

@@ -2,68 +2,67 @@ name: Smart Lock
 products:
   - id: kdq0tdbz
     name: Pulido ‎P13
-primary_entity:
-  entity: lock
-  dps:
-    - id: 1
-      type: string
-      name: create_unlock_method
-      optional: true
-      sensitive: true
-    - id: 2
-      type: string
-      name: delete_unlock_method
-      optional: true
-    - id: 3
-      type: string
-      name: modify_unlock_method
-      optional: true
-      sensitive: true
-    - id: 12
-      type: integer
-      name: unlock_fingerprint
-      optional: true
-      persist: false
-    - id: 13
-      name: unlock_password
-      type: integer
-      optional: true
-      persist: false
-    - id: 15
-      name: unlock_card
-      type: integer
-      optional: true
-      persist: false
-    - id: 19
-      name: unlock_ble
-      type: integer
-      optional: true
-      persist: false
-    - id: 47  # Lock motor state
-      name: lock
-      type: boolean
-      readonly: true
-      mapping:
-        - dps_val: true  # Unlocked
-          value: false
-        - dps_val: false  # Locked
-          value: true
-    - id: 55
-      type: integer
-      name: unlock_temp_pwd
-      optional: true
-      persist: false
-    - id: 62
-      type: integer
-      name: unlock_app
-      optional: true
-      persist: false
-    - id: 63
-      name: unlock_voice
-      type: integer
-      optional: true
-      persist: false
-secondary_entities:
+entities:
+  - entity: lock
+    dps:
+      - id: 1
+        type: string
+        name: create_unlock_method
+        optional: true
+        sensitive: true
+      - id: 2
+        type: string
+        name: delete_unlock_method
+        optional: true
+      - id: 3
+        type: string
+        name: modify_unlock_method
+        optional: true
+        sensitive: true
+      - id: 12
+        type: integer
+        name: unlock_fingerprint
+        optional: true
+        persist: false
+      - id: 13
+        name: unlock_password
+        type: integer
+        optional: true
+        persist: false
+      - id: 15
+        name: unlock_card
+        type: integer
+        optional: true
+        persist: false
+      - id: 19
+        name: unlock_ble
+        type: integer
+        optional: true
+        persist: false
+      - id: 47  # Lock motor state
+        name: lock
+        type: boolean
+        readonly: true
+        mapping:
+          - dps_val: true  # Unlocked
+            value: false
+          - dps_val: false  # Locked
+            value: true
+      - id: 55
+        type: integer
+        name: unlock_temp_pwd
+        optional: true
+        persist: false
+      - id: 62
+        type: integer
+        name: unlock_app
+        optional: true
+        persist: false
+      - id: 63
+        name: unlock_voice
+        type: integer
+        optional: true
+        persist: false
   - entity: sensor
     name: Alert
     class: enum

+ 9 - 10
custom_components/tuya_local/devices/ble_smart_plant_moisture.yaml

@@ -2,16 +2,15 @@ name: Moisture sensor
 products:
   - id: gvygg3m8
     name: SGS01
-primary_entity:
-  entity: sensor
-  name: Soil Moisture
-  class: moisture
-  dps:
-    - id: 3
-      name: sensor
-      type: integer
-      unit: "%"
-secondary_entities:
+entities:
+  - entity: sensor
+    name: Soil Moisture
+    class: moisture
+    dps:
+      - id: 3
+        name: sensor
+        type: integer
+        unit: "%"
   - entity: sensor
     name: Soil Temperature
     class: temperature

Некоторые файлы не были показаны из-за большого количества измененных файлов