Kaynağa Gözat

config: reimplement mask as documented.

Mask is documented as being at dp level, but was implemented as being
a mapping.

Mapping makes sense from the point of view that this changes the
values, but it adds extra complexity in the case when there are
mappings for the values, since the mask must be listed for every
mapping. If included in the mapping, it looks like it gives extra
flexibility of using a different mask for different values, but I
can't think of a use use for this, nor can I imagine what the expected
behaviour should be for multiple matches or how reverse mappings
could be implemented in that case.

Making this dp level as documented simplifies some configs, and avoids
the possibility of inconsistent masking within a dp.

PR #1383
Jason Rumney 1 yıl önce
ebeveyn
işleme
076cb6b1d7
48 değiştirilmiş dosya ile 818 ekleme ve 1152 silme
  1. 6 6
      custom_components/tuya_local/devices/afyeev_16a_evcharger.yaml
  2. 6 6
      custom_components/tuya_local/devices/afyeev_evcharger.yaml
  3. 1 2
      custom_components/tuya_local/devices/arlec_rgb_ledstrip.yaml
  4. 6 6
      custom_components/tuya_local/devices/aulifants_energymonitor_breaker.yaml
  5. 12 12
      custom_components/tuya_local/devices/avidsen_soria_solarinverter.yaml
  6. 2 4
      custom_components/tuya_local/devices/daizuki_heatpump.yaml
  7. 6 6
      custom_components/tuya_local/devices/earu_smart_wifi_circuit_breaker_with_energy_monitor.yaml
  8. 23 24
      custom_components/tuya_local/devices/ecopoint_ev_charger.yaml
  9. 6 6
      custom_components/tuya_local/devices/emylo_energy_meter.yaml
  10. 24 48
      custom_components/tuya_local/devices/enbrighten_cafe_stringlights.yaml
  11. 6 6
      custom_components/tuya_local/devices/evsun_evcharger.yaml
  12. 2 4
      custom_components/tuya_local/devices/fujicool_yuzu_heatpump.yaml
  13. 40 80
      custom_components/tuya_local/devices/holman_wx1_taptimer.yaml
  14. 80 160
      custom_components/tuya_local/devices/holman_wx2_taptimer.yaml
  15. 25 25
      custom_components/tuya_local/devices/inkbird_bbq4t_thermometerv2.yaml
  16. 64 78
      custom_components/tuya_local/devices/inkbird_ibs_m1s.yaml
  17. 1 2
      custom_components/tuya_local/devices/lsc_smart_ceiling_light.yaml
  18. 2 4
      custom_components/tuya_local/devices/mrc_magnum_floorheater.yaml
  19. 18 18
      custom_components/tuya_local/devices/nine_ev_charger.yaml
  20. 20 22
      custom_components/tuya_local/devices/noeifevo_q21w_evcharger.yaml
  21. 6 6
      custom_components/tuya_local/devices/parkside_solar_inverter.yaml
  22. 9 9
      custom_components/tuya_local/devices/pc321zty_energy_meter.yaml
  23. 107 130
      custom_components/tuya_local/devices/powerworld_pw58410_hvaconly.yaml
  24. 107 130
      custom_components/tuya_local/devices/powerworld_pw58410_waterheater.yaml
  25. 2 5
      custom_components/tuya_local/devices/relay_switch_remote.yaml
  26. 4 10
      custom_components/tuya_local/devices/rotenso_ronix_heatpump.yaml
  27. 9 18
      custom_components/tuya_local/devices/royalclima_fresh_climate.yaml
  28. 6 6
      custom_components/tuya_local/devices/smartmcb_smt006_energymeter.yaml
  29. 6 6
      custom_components/tuya_local/devices/smartmcb_smt006_energymeterv2.yaml
  30. 13 14
      custom_components/tuya_local/devices/solar_inverter_gtb_series.yaml
  31. 7 14
      custom_components/tuya_local/devices/starlight_heatpump.yaml
  32. 18 18
      custom_components/tuya_local/devices/tera_w01_evcharger.yaml
  33. 6 6
      custom_components/tuya_local/devices/tompd_63lw_breaker.yaml
  34. 9 9
      custom_components/tuya_local/devices/tongou_qcb2_circuitbreaker.yaml
  35. 3 3
      custom_components/tuya_local/devices/tongou_qcb2_singlephasebreaker.yaml
  36. 18 18
      custom_components/tuya_local/devices/tongou_st463jwt_breaker.yaml
  37. 6 6
      custom_components/tuya_local/devices/tongou_toqsyswt_breaker.yaml
  38. 30 114
      custom_components/tuya_local/devices/tuya_000004rime_weather_station.yaml
  39. 3 3
      custom_components/tuya_local/devices/vevor_ev_charger.yaml
  40. 3 3
      custom_components/tuya_local/devices/vevor_l2_ev_charger.yaml
  41. 2 4
      custom_components/tuya_local/devices/wadapower_q8_evcharger.yaml
  42. 18 18
      custom_components/tuya_local/devices/wdyk_2p63a_energy_meter.yaml
  43. 13 13
      custom_components/tuya_local/devices/wdyk_3phase_energymonitor.yaml
  44. 18 18
      custom_components/tuya_local/devices/wdyk_4p100a_energymeter.yaml
  45. 18 18
      custom_components/tuya_local/devices/yagusmart_3pn_energymeter.yaml
  46. 6 6
      custom_components/tuya_local/devices/zm_wifi_smartmeter.yaml
  47. 17 20
      custom_components/tuya_local/helpers/device_config.py
  48. 4 8
      tests/test_device_config.py

+ 6 - 6
custom_components/tuya_local/devices/afyeev_16a_evcharger.yaml

@@ -64,9 +64,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     dps:
     dps:
@@ -75,9 +75,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFF000000"
         mapping:
         mapping:
-          - mask: "000000FFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     dps:
     dps:
@@ -87,9 +87,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "000000000000FFFF"
         mapping:
         mapping:
-          - mask: "000000000000FFFF"
-            scale: 1000
+          - scale: 1000
           - dps_val: null
           - dps_val: null
             value_redirect: total_power
             value_redirect: total_power
       - id: 9
       - id: 9

+ 6 - 6
custom_components/tuya_local/devices/afyeev_evcharger.yaml

@@ -217,9 +217,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Phase A current
     name: Phase A current
     class: current
     class: current
@@ -229,9 +229,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFF000000"
         mapping:
         mapping:
-          - mask: "000000FFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Phase A power
     name: Phase A power
     class: power
     class: power
@@ -241,6 +241,6 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "000000000000FFFF"
         mapping:
         mapping:
-          - mask: "000000000000FFFF"
-            scale: 1000
+          - scale: 1000

+ 1 - 2
custom_components/tuya_local/devices/arlec_rgb_ledstrip.yaml

@@ -45,8 +45,7 @@ primary_entity:
       range:
       range:
         min: 0
         min: 0
         max: 1000
         max: 1000
-      mapping:
-        - mask: "00000000FFFF"
+      mask: "00000000FFFF"
     - id: 6
     - id: 6
       type: hex
       type: hex
       name: scene_data
       name: scene_data

+ 6 - 6
custom_components/tuya_local/devices/aulifants_energymonitor_breaker.yaml

@@ -23,9 +23,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     dps:
     dps:
@@ -33,9 +33,9 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     dps:
     dps:
@@ -43,9 +43,9 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: button
   - entity: button
     name: Clear energy
     name: Clear energy
     category: config
     category: config

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

@@ -98,10 +98,10 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: V
         unit: V
+        mask: "FFFF00000000"
         optional: true
         optional: true
         mapping:
         mapping:
-          - mask: "FFFF00000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: PV DC Current
     name: PV DC Current
     class: current
     class: current
@@ -112,9 +112,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         optional: true
         optional: true
+        mask: "0000FFFF0000"
         mapping:
         mapping:
-          - mask: "0000FFFF0000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: PV DC Power
     name: PV DC Power
     class: power
     class: power
@@ -125,9 +125,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: W
         unit: W
         optional: true
         optional: true
+        mask: "00000000FFFF"
         mapping:
         mapping:
-          - mask: "00000000FFFF"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: AC Voltage
     name: AC Voltage
     class: voltage
     class: voltage
@@ -138,9 +138,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: V
         unit: V
         optional: true
         optional: true
+        mask: "FFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: AC Current
     name: AC Current
     class: current
     class: current
@@ -151,9 +151,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         optional: true
         optional: true
+        mask: "0000FFFFFF0000000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF0000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: AC active power
     name: AC active power
     class: power
     class: power
@@ -164,9 +164,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: W
         unit: W
         optional: true
         optional: true
+        mask: "0000000000FFFFFF0000"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: temperature
     class: temperature
     category: diagnostic
     category: diagnostic

+ 2 - 4
custom_components/tuya_local/devices/daizuki_heatpump.yaml

@@ -225,8 +225,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
   - entity: switch
     name: Beep
     name: Beep
     category: config
     category: config
@@ -234,8 +233,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 6 - 6
custom_components/tuya_local/devices/earu_smart_wifi_circuit_breaker_with_energy_monitor.yaml

@@ -40,9 +40,9 @@ secondary_entities:
         unit: V
         unit: V
         class: measurement
         class: measurement
         name: sensor
         name: sensor
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -53,9 +53,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: A
         unit: A
         name: sensor
         name: sensor
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic
@@ -66,6 +66,6 @@ secondary_entities:
         type: base64
         type: base64
         unit: kW
         unit: kW
         name: sensor
         name: sensor
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000

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

@@ -148,9 +148,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -160,9 +160,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -172,9 +172,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -184,9 +184,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -196,9 +196,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -208,9 +208,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -220,9 +220,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -232,9 +232,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -244,9 +244,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: temperature
     class: temperature
     category: diagnostic
     category: diagnostic
@@ -308,8 +308,7 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: s
         unit: s
-        mapping:
-          - mask: "0000FFFF"
+        mask: "0000FFFF"
   - entity: select
   - entity: select
     name: Mode
     name: Mode
     icon: "mdi:cogs"
     icon: "mdi:cogs"
@@ -338,9 +337,9 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
+        mask: "FFFF0000"
         mapping:
         mapping:
-          - mask: "FFFF0000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Maximum current
     name: Maximum current
     class: current
     class: current
@@ -351,6 +350,6 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
+        mask: "0000FFFF"
         mapping:
         mapping:
-          - mask: "0000FFFF"
-            scale: 10
+          - scale: 10

+ 6 - 6
custom_components/tuya_local/devices/emylo_energy_meter.yaml

@@ -102,9 +102,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -115,9 +115,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -128,6 +128,6 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000

+ 24 - 48
custom_components/tuya_local/devices/enbrighten_cafe_stringlights.yaml

@@ -56,8 +56,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "100000000000000000000000"
+        mask: "100000000000000000000000"
   - entity: light
   - entity: light
     name: LED 2
     name: LED 2
     category: config
     category: config
@@ -65,8 +64,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "010000000000000000000000"
+        mask: "010000000000000000000000"
   - entity: light
   - entity: light
     name: LED 3
     name: LED 3
     category: config
     category: config
@@ -74,8 +72,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "001000000000000000000000"
+        mask: "001000000000000000000000"
   - entity: light
   - entity: light
     name: LED 4
     name: LED 4
     category: config
     category: config
@@ -83,8 +80,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000100000000000000000000"
+        mask: "000100000000000000000000"
   - entity: light
   - entity: light
     name: LED 5
     name: LED 5
     category: config
     category: config
@@ -92,8 +88,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000010000000000000000000"
+        mask: "000010000000000000000000"
   - entity: light
   - entity: light
     name: LED 6
     name: LED 6
     category: config
     category: config
@@ -101,8 +96,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000001000000000000000000"
+        mask: "000001000000000000000000"
   - entity: light
   - entity: light
     name: LED 7
     name: LED 7
     category: config
     category: config
@@ -110,8 +104,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000100000000000000000"
+        mask: "000000100000000000000000"
   - entity: light
   - entity: light
     name: LED 8
     name: LED 8
     category: config
     category: config
@@ -119,8 +112,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000010000000000000000"
+        mask: "000000010000000000000000"
   - entity: light
   - entity: light
     name: LED 9
     name: LED 9
     category: config
     category: config
@@ -128,8 +120,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000001000000000000000"
+        mask: "000000001000000000000000"
   - entity: light
   - entity: light
     name: LED 10
     name: LED 10
     category: config
     category: config
@@ -137,8 +128,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000100000000000000"
+        mask: "000000000100000000000000"
   - entity: light
   - entity: light
     name: LED 11
     name: LED 11
     category: config
     category: config
@@ -146,8 +136,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000010000000000000"
+        mask: "000000000010000000000000"
   - entity: light
   - entity: light
     name: LED 12
     name: LED 12
     category: config
     category: config
@@ -155,8 +144,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000001000000000000"
+        mask: "000000000001000000000000"
   - entity: light
   - entity: light
     name: LED 13
     name: LED 13
     category: config
     category: config
@@ -164,8 +152,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000100000000000"
+        mask: "000000000000100000000000"
   - entity: light
   - entity: light
     name: LED 14
     name: LED 14
     category: config
     category: config
@@ -173,8 +160,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000010000000000"
+        mask: "000000000000010000000000"
   - entity: light
   - entity: light
     name: LED 15
     name: LED 15
     category: config
     category: config
@@ -182,8 +168,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000001000000000"
+        mask: "000000000000001000000000"
   - entity: light
   - entity: light
     name: LED 16
     name: LED 16
     category: config
     category: config
@@ -191,8 +176,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000100000000"
+        mask: "000000000000000100000000"
   - entity: light
   - entity: light
     name: LED 17
     name: LED 17
     category: config
     category: config
@@ -200,8 +184,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000010000000"
+        mask: "000000000000000010000000"
   - entity: light
   - entity: light
     name: LED 18
     name: LED 18
     category: config
     category: config
@@ -209,8 +192,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000001000000"
+        mask: "000000000000000001000000"
   - entity: light
   - entity: light
     name: LED 19
     name: LED 19
     category: config
     category: config
@@ -218,8 +200,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000100000"
+        mask: "000000000000000000100000"
   - entity: light
   - entity: light
     name: LED 20
     name: LED 20
     category: config
     category: config
@@ -227,8 +208,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000010000"
+        mask: "000000000000000000010000"
   - entity: light
   - entity: light
     name: LED 21
     name: LED 21
     category: config
     category: config
@@ -236,8 +216,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000001000"
+        mask: "000000000000000000001000"
   - entity: light
   - entity: light
     name: LED 22
     name: LED 22
     category: config
     category: config
@@ -245,8 +224,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000000100"
+        mask: "000000000000000000000100"
   - entity: light
   - entity: light
     name: LED 23
     name: LED 23
     category: config
     category: config
@@ -254,8 +232,7 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000000010"
+        mask: "000000000000000000000010"
   - entity: light
   - entity: light
     name: LED 24
     name: LED 24
     category: config
     category: config
@@ -263,5 +240,4 @@ secondary_entities:
       - id: 104
       - id: 104
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "000000000000000000000001"
+        mask: "000000000000000000000001"

+ 6 - 6
custom_components/tuya_local/devices/evsun_evcharger.yaml

@@ -91,9 +91,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Phase A current
     name: Phase A current
     class: current
     class: current
@@ -105,9 +105,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         class: measurement
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Phase A power
     name: Phase A power
     class: power
     class: power
@@ -119,9 +119,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Total power
     name: Total power
     class: power
     class: power

+ 2 - 4
custom_components/tuya_local/devices/fujicool_yuzu_heatpump.yaml

@@ -227,8 +227,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
   - entity: switch
     name: Beep
     name: Beep
     category: config
     category: config
@@ -236,8 +235,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: sensor
   - entity: sensor
     class: pm25
     class: pm25
     category: diagnostic
     category: diagnostic

+ 40 - 80
custom_components/tuya_local/devices/holman_wx1_taptimer.yaml

@@ -130,32 +130,27 @@ secondary_entities:
         # flags for days of the week Sun-Sat, plus a bit for on/off
         # flags for days of the week Sun-Sat, plus a bit for on/off
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start B encoded
     name: Start B encoded
     category: diagnostic
     category: diagnostic
@@ -168,32 +163,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start C encoded
     name: Start C encoded
     category: diagnostic
     category: diagnostic
@@ -206,32 +196,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
   - entity: select
     name: Watering delay
     name: Watering delay
     translation_key: timer
     translation_key: timer
@@ -302,122 +287,102 @@ secondary_entities:
         optional: true
         optional: true
         name: 10_days
         name: 10_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 10_days_256
         name: 10_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 9_days
         name: 9_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 9_days_256
         name: 9_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 8_days
         name: 8_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 8_days_256
         name: 8_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 7_days
         name: 7_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 7_days_256
         name: 7_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 6_days
         name: 6_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 6_days_256
         name: 6_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 5_days
         name: 5_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 5_days_256
         name: 5_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 4_days
         name: 4_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 4_days_256
         name: 4_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 3_days
         name: 3_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 3_days_256
         name: 3_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 2_days
         name: 2_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 2_days_256
         name: 2_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 1_day
         name: 1_day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 1_day_256
         name: 1_day_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
   - entity: sensor
     name: Temperature count encoded
     name: Temperature count encoded
     category: diagnostic
     category: diagnostic
@@ -458,29 +423,24 @@ secondary_entities:
         optional: true
         optional: true
         name: minute
         name: minute
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: hour
         name: hour
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: day
         name: day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: month
         name: month
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: year
         name: year
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"

+ 80 - 160
custom_components/tuya_local/devices/holman_wx2_taptimer.yaml

@@ -152,32 +152,27 @@ secondary_entities:
         # flags for days of the week Sun-Sat, plus a bit for on/off
         # flags for days of the week Sun-Sat, plus a bit for on/off
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 110
       - id: 110
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start B 1 encoded
     name: Start B 1 encoded
     category: diagnostic
     category: diagnostic
@@ -190,32 +185,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 111
       - id: 111
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start C 1 encoded
     name: Start C 1 encoded
     category: diagnostic
     category: diagnostic
@@ -228,32 +218,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 112
       - id: 112
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
   - entity: select
     name: Watering delay 1
     name: Watering delay 1
     translation_key: timer
     translation_key: timer
@@ -338,122 +323,102 @@ secondary_entities:
         optional: true
         optional: true
         name: 10_days
         name: 10_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 10_days_256
         name: 10_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 9_days
         name: 9_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 9_days_256
         name: 9_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 8_days
         name: 8_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 8_days_256
         name: 8_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 7_days
         name: 7_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 7_days_256
         name: 7_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 6_days
         name: 6_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 6_days_256
         name: 6_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 5_days
         name: 5_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 5_days_256
         name: 5_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 4_days
         name: 4_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 4_days_256
         name: 4_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 3_days
         name: 3_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 3_days_256
         name: 3_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 2_days
         name: 2_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 2_days_256
         name: 2_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 1_day
         name: 1_day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 121
       - id: 121
         optional: true
         optional: true
         name: 1_day_256
         name: 1_day_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
   - entity: sensor
     name: Temperature count 1 encoded
     name: Temperature count 1 encoded
     category: diagnostic
     category: diagnostic
@@ -497,32 +462,27 @@ secondary_entities:
         optional: true
         optional: true
         name: minute
         name: minute
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: hour
         name: hour
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: day
         name: day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: month
         name: month
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 128
       - id: 128
         optional: true
         optional: true
         name: year
         name: year
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
   - entity: sensor
   - entity: sensor
     name: Soil temperature 2
     name: Soil temperature 2
     class: temperature
     class: temperature
@@ -605,32 +565,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 157
       - id: 157
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 157
       - id: 157
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 157
       - id: 157
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 157
       - id: 157
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start B 2 encoded
     name: Start B 2 encoded
     category: diagnostic
     category: diagnostic
@@ -643,32 +598,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 158
       - id: 158
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 158
       - id: 158
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 158
       - id: 158
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 158
       - id: 158
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
   - entity: sensor
     name: Start C 2 encoded
     name: Start C 2 encoded
     category: diagnostic
     category: diagnostic
@@ -681,32 +631,27 @@ secondary_entities:
         optional: true
         optional: true
         name: days
         name: days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 159
       - id: 159
         optional: true
         optional: true
         name: minutes_duration
         name: minutes_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 159
       - id: 159
         optional: true
         optional: true
         name: hours_duration
         name: hours_duration
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 159
       - id: 159
         optional: true
         optional: true
         name: minutes_start
         name: minutes_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 159
       - id: 159
         optional: true
         optional: true
         name: hours_start
         name: hours_start
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
   - entity: select
     name: Watering delay 2
     name: Watering delay 2
     translation_key: timer
     translation_key: timer
@@ -751,122 +696,102 @@ secondary_entities:
         optional: true
         optional: true
         name: 10_days
         name: 10_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 10_days_256
         name: 10_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 9_days
         name: 9_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 9_days_256
         name: 9_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 8_days
         name: 8_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 8_days_256
         name: 8_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 7_days
         name: 7_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 7_days_256
         name: 7_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 6_days
         name: 6_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 6_days_256
         name: 6_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 5_days
         name: 5_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 5_days_256
         name: 5_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 4_days
         name: 4_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 4_days_256
         name: 4_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 3_days
         name: 3_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 3_days_256
         name: 3_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 2_days
         name: 2_days
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 2_days_256
         name: 2_days_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 1_day
         name: 1_day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 163
       - id: 163
         optional: true
         optional: true
         name: 1_day_256
         name: 1_day_256
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
   - entity: sensor
     name: Temperature count 2 encoded
     name: Temperature count 2 encoded
     category: diagnostic
     category: diagnostic
@@ -902,29 +827,24 @@ secondary_entities:
         optional: true
         optional: true
         name: minute
         name: minute
         type: base64
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 167
       - id: 167
         optional: true
         optional: true
         name: hour
         name: hour
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 167
       - id: 167
         optional: true
         optional: true
         name: day
         name: day
         type: base64
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 167
       - id: 167
         optional: true
         optional: true
         name: month
         name: month
         type: base64
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 167
       - id: 167
         optional: true
         optional: true
         name: year
         name: year
         type: base64
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"

+ 25 - 25
custom_components/tuya_local/devices/inkbird_bbq4t_thermometerv2.yaml

@@ -12,10 +12,10 @@ primary_entity:
       name: sensor
       name: sensor
       class: measurement
       class: measurement
       optional: true
       optional: true
+      mask: FFFFFF
+      endianness: little
       mapping:
       mapping:
-        - mask: FFFFFF
-          endianness: little
-          scale: 100
+        - scale: 100
       unit: F
       unit: F
 secondary_entities:
 secondary_entities:
   - entity: sensor
   - entity: sensor
@@ -27,10 +27,10 @@ secondary_entities:
         name: sensor
         name: sensor
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: FFFFFF00000000
+        endianness: little
         mapping:
         mapping:
           - scale: 100
           - scale: 100
-            mask: FFFFFF00000000
-            endianness: little
         unit: F
         unit: F
   - entity: sensor
   - entity: sensor
     name: Temperature probe 3
     name: Temperature probe 3
@@ -41,10 +41,10 @@ secondary_entities:
         name: sensor
         name: sensor
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: FFFFFF0000000000000000
+        endianness: little
         mapping:
         mapping:
           - scale: 100
           - scale: 100
-            mask: FFFFFF0000000000000000
-            endianness: little
         unit: F
         unit: F
   - entity: sensor
   - entity: sensor
     name: Temperature probe 4
     name: Temperature probe 4
@@ -55,10 +55,10 @@ secondary_entities:
         name: sensor
         name: sensor
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: FFFFFF000000000000000000000000
+        endianness: little
         mapping:
         mapping:
           - scale: 100
           - scale: 100
-            mask: FFFFFF000000000000000000000000
-            endianness: little
         unit: F
         unit: F
   - entity: binary_sensor
   - entity: binary_sensor
     class: power
     class: power
@@ -144,14 +144,14 @@ secondary_entities:
         range:
         range:
           min: 0
           min: 0
           max: 50000
           max: 50000
+        # mask seems to be wrong, only data available has 40 A characters,
+        # presumably base64 encoded 28 bytes of 00, but could also be
+        # 20 hex bytes. Not sure of the meaning, whether it is 7 (or 5)
+        # bytes per probe or some of the bytes are general settings.
+        mask: FFFF000000000000
+        endianness: little
         mapping:
         mapping:
-          # mask seems to be wrong, only data available has 40 A characters,
-          # presumably base64 encoded 28 bytes of 00, but could also be
-          # 20 hex bytes. Not sure of the meaning, whether it is 7 (or 5)
-          # bytes per probe or some of the bytes are general settings.
-          - mask: FFFF000000000000
-            endianness: little
-            scale: 100
+          - scale: 100
   - entity: number
   - entity: number
     name: Preset temperature 2
     name: Preset temperature 2
     category: config
     category: config
@@ -165,10 +165,10 @@ secondary_entities:
         range:
         range:
           min: 0
           min: 0
           max: 50000
           max: 50000
+        mask: 0000FFFF00000000
+        endianness: little
         mapping:
         mapping:
-          - mask: 0000FFFF00000000
-            endianness: little
-            scale: 100
+          - scale: 100
   - entity: number
   - entity: number
     name: Preset temperature 3
     name: Preset temperature 3
     category: config
     category: config
@@ -182,10 +182,10 @@ secondary_entities:
         range:
         range:
           min: 0
           min: 0
           max: 50000
           max: 50000
+        mask: 00000000FFFF0000
+        endianness: little
         mapping:
         mapping:
-          - mask: 00000000FFFF0000
-            endianness: little
-            scale: 100
+          - scale: 100
   - entity: number
   - entity: number
     name: Preset temperature 4
     name: Preset temperature 4
     category: config
     category: config
@@ -199,7 +199,7 @@ secondary_entities:
         range:
         range:
           min: 0
           min: 0
           max: 50000
           max: 50000
+        mask: 000000000000FFFF
+        endianness: little
         mapping:
         mapping:
-          - mask: 000000000000FFFF
-            endianness: little
-            scale: 100
+          - scale: 100

+ 64 - 78
custom_components/tuya_local/devices/inkbird_ibs_m1s.yaml

@@ -18,19 +18,18 @@ primary_entity:
       type: base64
       type: base64
       name: type
       name: type
       persist: false
       persist: false
-      mapping:
-        - endianness: little
-          mask: "FF"
+      endianness: little
+      mask: "FF"
     - id: 114
     - id: 114
       optional: true
       optional: true
       type: base64
       type: base64
       name: sensor
       name: sensor
       unit: C
       unit: C
       class: measurement
       class: measurement
+      endianness: little
+      mask: "FFFF00"
       mapping:
       mapping:
         - scale: 10
         - scale: 10
-          endianness: little
-          mask: "FFFF00"
           constraint: type
           constraint: type
           conditions:
           conditions:
             - dps_val: 0
             - dps_val: 0
@@ -46,18 +45,17 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF"
+        endianness: little
+        mask: "FF"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true
@@ -70,19 +68,18 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: C
         unit: C
         class: measurement
         class: measurement
+        endianness: little
+        mask: "FFFF0000000000000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            endianness: little
-            mask: "FFFF0000000000000000000000"
             constraint: type
             constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
@@ -97,18 +94,17 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true
@@ -121,19 +117,18 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: C
         unit: C
         class: measurement
         class: measurement
+        endianness: little
+        mask: "FFFF000000000000000000000000000000000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            endianness: little
-            mask: "FFFF000000000000000000000000000000000000000000"
             constraint: type
             constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
@@ -148,18 +143,17 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true
@@ -172,21 +166,19 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: >-
-              FF000000000000000000000000000000000000000000000000000000000000
+        endianness: little
+        mask: FF000000000000000000000000000000000000000000000000000000000000
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: C
         unit: C
         class: measurement
         class: measurement
+        endianness: little
+        mask: >-
+          FFFF00000000000000000000000000000000000000000000000000000000000000
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            endianness: little
-            mask: >-
-              FFFF00000000000000000000000000000000000000000000000000000000000000
             constraint: type
             constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
@@ -201,20 +193,18 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: >-
-              FF000000000000000000000000000000000000000000000000000000000000
+        endianness: little
+        mask: FF000000000000000000000000000000000000000000000000000000000000
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000\
+          000000000000000000000000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000\
-              000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true
@@ -227,21 +217,20 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000\
-              000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000\
+          000000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: C
         unit: C
         class: measurement
         class: measurement
+        endianness: little
+        mask: "FFFF00000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            endianness: little
-            mask: "FFFF00000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000"
             constraint: type
             constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
@@ -256,20 +245,19 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true
@@ -282,21 +270,20 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000\
-              0000000000000000000000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000\
+          0000000000000000000000000000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: C
         unit: C
         class: measurement
         class: measurement
+        endianness: little
+        mask: "FFFF00000000000000000000000000000000000000000000000\
+          0000000000000000000000000000000000000000000000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            endianness: little
-            mask: "FFFF00000000000000000000000000000000000000000000000\
-              0000000000000000000000000000000000000000000000000000000"
             constraint: type
             constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
@@ -311,20 +298,19 @@ secondary_entities:
         type: base64
         type: base64
         name: type
         name: type
         persist: false
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000"
       - id: 114
       - id: 114
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000000000000"
         mapping:
         mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
             conditions:
               - dps_val: 0
               - dps_val: 0
                 invalid: true
                 invalid: true

+ 1 - 2
custom_components/tuya_local/devices/lsc_smart_ceiling_light.yaml

@@ -60,8 +60,7 @@ secondary_entities:
         range:
         range:
           min: 0
           min: 0
           max: 1000
           max: 1000
-        mapping:
-          - mask: "00000000FFFF"
+        mask: "00000000FFFF"
 
 
   - entity: select
   - entity: select
     translation_key: initial_state
     translation_key: initial_state

+ 2 - 4
custom_components/tuya_local/devices/mrc_magnum_floorheater.yaml

@@ -354,8 +354,7 @@ secondary_entities:
         type: integer
         type: integer
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
-        mapping:
-          - mask: 00FF
+        mask: 00FF
   - entity: sensor
   - entity: sensor
     name: Yearly consumption
     name: Yearly consumption
     category: diagnostic
     category: diagnostic
@@ -364,8 +363,7 @@ secondary_entities:
         type: integer
         type: integer
         name: sensor
         name: sensor
         unit: "%"
         unit: "%"
-        mapping:
-          - mask: FF00
+        mask: FF00
   - entity: select
   - entity: select
     name: Floor covering
     name: Floor covering
     icon: "mdi:floor-plan"
     icon: "mdi:floor-plan"

+ 18 - 18
custom_components/tuya_local/devices/nine_ev_charger.yaml

@@ -140,9 +140,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -152,9 +152,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF0000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -164,9 +164,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -176,9 +176,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -188,9 +188,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -200,9 +200,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -212,9 +212,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -224,9 +224,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -236,9 +236,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: number
   - entity: number
     name: Charge time
     name: Charge time
     category: config
     category: config

+ 20 - 22
custom_components/tuya_local/devices/noeifevo_q21w_evcharger.yaml

@@ -93,9 +93,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -105,9 +105,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFF0000"
         mapping:
         mapping:
-          - mask: "000000FFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -117,9 +117,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -129,9 +129,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -141,9 +141,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFF0000"
         mapping:
         mapping:
-          - mask: "000000FFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -153,9 +153,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -165,9 +165,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -177,9 +177,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFF0000"
         mapping:
         mapping:
-          - mask: "000000FFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -189,9 +189,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Schedule start
     name: Schedule start
     icon: "mdi:battery-clock"
     icon: "mdi:battery-clock"
@@ -200,8 +200,7 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         optional: true
         optional: true
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
   - entity: sensor
   - entity: sensor
     name: Schedule stop
     name: Schedule stop
     icon: "mdi:battery-clock-outline"
     icon: "mdi:battery-clock-outline"
@@ -210,8 +209,7 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         optional: true
         optional: true
-        mapping:
-          - mask: "00FF"
+        mask: "00FF"
   - entity: switch
   - entity: switch
     icon: "mdi:ev-station"
     icon: "mdi:ev-station"
     dps:
     dps:

+ 6 - 6
custom_components/tuya_local/devices/parkside_solar_inverter.yaml

@@ -55,9 +55,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: V
         unit: V
         force: true
         force: true
+        mask: "FFFF00000000"
         mapping:
         mapping:
-          - mask: "FFFF00000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: DC current
     name: DC current
     class: current
     class: current
@@ -68,9 +68,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         force: true
         force: true
+        mask: "0000FFFF0000"
         mapping:
         mapping:
-          - mask: "0000FFFF0000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: AC voltage
     name: AC voltage
     class: voltage
     class: voltage
@@ -81,9 +81,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: V
         unit: V
         force: true
         force: true
+        mask: "FFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000000000"
-            scale: 10
+          - scale: 10
 
 
   - entity: switch
   - entity: switch
     name: Inverter switch
     name: Inverter switch

+ 9 - 9
custom_components/tuya_local/devices/pc321zty_energy_meter.yaml

@@ -34,9 +34,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: V
         unit: V
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Current A
     name: Current A
@@ -47,9 +47,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: A
         unit: A
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Power A
     name: Power A
@@ -60,9 +60,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: kW
         unit: kW
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Voltage B
     name: Voltage B
@@ -73,9 +73,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: V
         unit: V
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Current B
     name: Current B
@@ -86,9 +86,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: A
         unit: A
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Power B
     name: Power B
@@ -99,9 +99,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: kW
         unit: kW
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Voltage C
     name: Voltage C
@@ -112,9 +112,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: V
         unit: V
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Current C
     name: Current C
@@ -125,9 +125,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: A
         unit: A
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Power C
     name: Power C
@@ -138,9 +138,9 @@ secondary_entities:
         type: base64
         type: base64
         unit: kW
         unit: kW
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic

+ 107 - 130
custom_components/tuya_local/devices/powerworld_pw58410_hvaconly.yaml

@@ -110,11 +110,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: current_temperature
         name: current_temperature
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 118
       - id: 118
         type: string
         type: string
         optional: true
         optional: true
@@ -198,11 +197,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -219,11 +217,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -240,11 +237,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -261,11 +257,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -282,11 +277,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -303,11 +297,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -324,11 +317,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -344,11 +336,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Secondary EEV opening
     name: Secondary EEV opening
     category: diagnostic
     category: diagnostic
@@ -357,11 +348,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Compressor current
     name: Compressor current
     class: current
     class: current
@@ -372,11 +362,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Heat sink temperature
     name: Heat sink temperature
     class: temperature
     class: temperature
@@ -386,11 +375,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -408,11 +396,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: V
         unit: V
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Compressor frequency
     name: Compressor frequency
     class: frequency
     class: frequency
@@ -423,11 +410,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: Hz
         unit: Hz
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Fan 1 speed
     name: Fan 1 speed
     category: diagnostic
     category: diagnostic
@@ -437,11 +423,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: rpm
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Fan 2 speed
     name: Fan 2 speed
     category: diagnostic
     category: diagnostic
@@ -451,11 +436,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: rpm
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: pressure
     class: pressure
     category: diagnostic
     category: diagnostic
@@ -465,11 +449,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: bar
         unit: bar
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Low pressure gas temperature
     name: Low pressure gas temperature
     class: temperature
     class: temperature
@@ -479,11 +462,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -501,12 +483,12 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: kW
         unit: kW
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: volume_flow_rate
     class: volume_flow_rate
     category: diagnostic
     category: diagnostic
@@ -516,12 +498,12 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: m³/h
         unit: m³/h
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -531,11 +513,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: voltage
     class: voltage
     category: diagnostic
     category: diagnostic
@@ -545,11 +526,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: V
         unit: V
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic
@@ -559,11 +539,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: W
         unit: W
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Coefficient of performance
     name: Coefficient of performance
     category: diagnostic
     category: diagnostic
@@ -572,12 +551,12 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: number
   - entity: number
     name: Pump speed
     name: Pump speed
     category: config
     category: config
@@ -586,11 +565,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: value
         name: value
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         range:
         range:
           min: 0
           min: 0
           max: 100
           max: 100
@@ -602,8 +580,7 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"

+ 107 - 130
custom_components/tuya_local/devices/powerworld_pw58410_waterheater.yaml

@@ -45,11 +45,10 @@ primary_entity:
       type: base64
       type: base64
       optional: true
       optional: true
       name: current_temperature
       name: current_temperature
-      mapping:
-        - mask: "000000000000000000000000000000000000000000000000\
-                 00000000FFFFFFFF00000000000000000000000000000000\
-                 000000000000000000000000000000000000000000000000\
-                 0000000000000000"
+      mask: "000000000000000000000000000000000000000000000000\
+             00000000FFFFFFFF00000000000000000000000000000000\
+             000000000000000000000000000000000000000000000000\
+             0000000000000000"
     - id: 118
     - id: 118
       type: string
       type: string
       optional: true
       optional: true
@@ -189,11 +188,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -210,11 +208,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -231,11 +228,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -252,11 +248,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -273,11 +268,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -294,11 +288,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -315,11 +308,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -335,11 +327,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Secondary EEV opening
     name: Secondary EEV opening
     category: diagnostic
     category: diagnostic
@@ -348,11 +339,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Compressor current
     name: Compressor current
     class: current
     class: current
@@ -363,11 +353,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Heat sink temperature
     name: Heat sink temperature
     class: temperature
     class: temperature
@@ -377,11 +366,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -399,11 +387,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: V
         unit: V
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Compressor frequency
     name: Compressor frequency
     class: frequency
     class: frequency
@@ -414,11 +401,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: Hz
         unit: Hz
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Fan 1 speed
     name: Fan 1 speed
     category: diagnostic
     category: diagnostic
@@ -428,11 +414,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: rpm
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Fan 2 speed
     name: Fan 2 speed
     category: diagnostic
     category: diagnostic
@@ -442,11 +427,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: rpm
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: pressure
     class: pressure
     category: diagnostic
     category: diagnostic
@@ -456,11 +440,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: bar
         unit: bar
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Low pressure gas temperature
     name: Low pressure gas temperature
     class: temperature
     class: temperature
@@ -470,11 +453,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               0000000000000000"
       - id: 6
       - id: 6
         type: string
         type: string
         name: unit
         name: unit
@@ -492,12 +474,12 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: kW
         unit: kW
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: volume_flow_rate
     class: volume_flow_rate
     category: diagnostic
     category: diagnostic
@@ -507,12 +489,12 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: m³/h
         unit: m³/h
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -522,11 +504,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: A
         unit: A
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: voltage
     class: voltage
     category: diagnostic
     category: diagnostic
@@ -536,11 +517,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: V
         unit: V
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic
@@ -550,11 +530,10 @@ secondary_entities:
         optional: true
         optional: true
         name: sensor
         name: sensor
         unit: W
         unit: W
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
   - entity: sensor
     name: Coefficient of performance
     name: Coefficient of performance
     category: diagnostic
     category: diagnostic
@@ -563,12 +542,12 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
         mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: number
   - entity: number
     name: Pump speed
     name: Pump speed
     category: config
     category: config
@@ -577,11 +556,10 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: value
         name: value
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         range:
         range:
           min: 0
           min: 0
           max: 100
           max: 100
@@ -593,8 +571,7 @@ secondary_entities:
         type: base64
         type: base64
         optional: true
         optional: true
         name: sensor
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"

+ 2 - 5
custom_components/tuya_local/devices/relay_switch_remote.yaml

@@ -76,14 +76,12 @@ secondary_entities:
       - id: 44
       - id: 44
         type: base64
         type: base64
         name: switch
         name: switch
+        mask: FF0000
         mapping:
         mapping:
-          - mask: FF0000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: FF0000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: FF0000
   - entity: number
   - entity: number
     name: Inching duration
     name: Inching duration
     category: config
     category: config
@@ -92,9 +90,8 @@ secondary_entities:
       - id: 44
       - id: 44
         type: base64
         type: base64
         name: value
         name: value
+        mask: 00FFFF
         unit: s
         unit: s
         range:
         range:
           min: 0
           min: 0
           max: 3600
           max: 3600
-        mapping:
-          - mask: 00FFFF

+ 4 - 10
custom_components/tuya_local/devices/rotenso_ronix_heatpump.yaml

@@ -218,8 +218,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
   - entity: switch
     name: Beep
     name: Beep
     category: config
     category: config
@@ -227,8 +226,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: switch
   - entity: switch
     name: Anti-mildew
     name: Anti-mildew
     category: config
     category: config
@@ -237,9 +235,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - scale: 1
-            mask: "0100"
+        mask: "0100"
   - entity: switch
   - entity: switch
     name: Eco mode
     name: Eco mode
     category: config
     category: config
@@ -248,9 +244,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - scale: 1
-            mask: "0001"
+        mask: "0001"
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 9 - 18
custom_components/tuya_local/devices/royalclima_fresh_climate.yaml

@@ -252,8 +252,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
   - entity: switch
     name: Adaptive display brightness
     name: Adaptive display brightness
     category: config
     category: config
@@ -262,8 +261,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0080"
+        mask: "0080"
   - entity: switch
   - entity: switch
     name: Beep
     name: Beep
     category: config
     category: config
@@ -272,8 +270,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: switch
   - entity: switch
     translation_key: uv_sterilization
     translation_key: uv_sterilization
     category: config
     category: config
@@ -281,8 +278,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0020"
+        mask: "0020"
   - entity: switch
   - entity: switch
     translation_key: evaporator_cleaning
     translation_key: evaporator_cleaning
     category: config
     category: config
@@ -290,8 +286,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0004"
+        mask: "0004"
   - entity: switch
   - entity: switch
     name: Eco mode
     name: Eco mode
     category: config
     category: config
@@ -300,8 +295,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0001"
+        mask: "0001"
   - entity: switch
   - entity: switch
     translation_key: anti_frost
     translation_key: anti_frost
     category: config
     category: config
@@ -309,8 +303,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "1000"
+        mask: "1000"
   - entity: switch
   - entity: switch
     name: Anti-mildew
     name: Anti-mildew
     category: config
     category: config
@@ -319,8 +312,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0100"
+        mask: "0100"
   - entity: switch
   - entity: switch
     name: Soft wind
     name: Soft wind
     category: config
     category: config
@@ -329,8 +321,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "8000"
+        mask: "8000"
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 6 - 6
custom_components/tuya_local/devices/smartmcb_smt006_energymeter.yaml

@@ -116,9 +116,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -129,9 +129,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF0000000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF0000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -142,9 +142,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF0000"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: temperature
     class: temperature
     category: diagnostic
     category: diagnostic

+ 6 - 6
custom_components/tuya_local/devices/smartmcb_smt006_energymeterv2.yaml

@@ -117,9 +117,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -130,9 +130,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -143,9 +143,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: temperature
     class: temperature
     category: diagnostic
     category: diagnostic

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

@@ -52,9 +52,9 @@ secondary_entities:
         optional: true
         optional: true
         force: true
         force: true
         class: measurement
         class: measurement
+        mask: "FFFF00000000"
         mapping:
         mapping:
-          - mask: "FFFF00000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: DC current
     name: DC current
     class: current
     class: current
@@ -66,9 +66,9 @@ secondary_entities:
         unit: A
         unit: A
         optional: true
         optional: true
         class: measurement
         class: measurement
+        mask: "0000FFFF0000"
         mapping:
         mapping:
-          - mask: "0000FFFF0000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: DC power
     name: DC power
     class: power
     class: power
@@ -80,9 +80,9 @@ secondary_entities:
         unit: W
         unit: W
         optional: true
         optional: true
         class: measurement
         class: measurement
+        mask: "00000000FFFF"
         mapping:
         mapping:
-          - mask: "00000000FFFF"
-            scale: 0.1
+          - scale: 0.1
   - entity: sensor
   - entity: sensor
     name: AC voltage
     name: AC voltage
     class: voltage
     class: voltage
@@ -95,9 +95,9 @@ secondary_entities:
         optional: true
         optional: true
         force: true
         force: true
         class: measurement
         class: measurement
+        mask: "FFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: AC current
     name: AC current
     class: current
     class: current
@@ -109,9 +109,9 @@ secondary_entities:
         unit: A
         unit: A
         optional: true
         optional: true
         class: measurement
         class: measurement
+        mask: "0000FFFFFF0000000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF0000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: AC power
     name: AC power
     class: power
     class: power
@@ -123,8 +123,7 @@ secondary_entities:
         unit: W
         unit: W
         optional: true
         optional: true
         class: measurement
         class: measurement
-        mapping:
-          - mask: "0000000000FFFFFF0000"
+        mask: "0000000000FFFFFF0000"
   - entity: sensor
   - entity: sensor
     name: AC frequency
     name: AC frequency
     class: frequency
     class: frequency
@@ -136,9 +135,9 @@ secondary_entities:
         unit: Hz
         unit: Hz
         optional: true
         optional: true
         class: measurement
         class: measurement
+        mask: "0000000000000000FFFF"
         mapping:
         mapping:
-          - mask: "0000000000000000FFFF"
-            scale: 10
+          - scale: 10
   - entity: switch
   - entity: switch
     category: config
     category: config
     dps:
     dps:

+ 7 - 14
custom_components/tuya_local/devices/starlight_heatpump.yaml

@@ -250,8 +250,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
   - entity: switch
     name: Buzzer
     name: Buzzer
     category: config
     category: config
@@ -260,8 +259,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: switch
   - entity: switch
     name: Soft wind
     name: Soft wind
     category: config
     category: config
@@ -270,8 +268,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "8000"
+        mask: "8000"
   - entity: switch
   - entity: switch
     name: Anti-mildew
     name: Anti-mildew
     category: config
     category: config
@@ -280,8 +277,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0100"
+        mask: "0100"
   - entity: switch
   - entity: switch
     name: Health
     name: Health
     category: config
     category: config
@@ -290,8 +286,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0020"
+        mask: "0020"
   - entity: switch
   - entity: switch
     translation_key: anti_frost
     translation_key: anti_frost
     category: config
     category: config
@@ -299,8 +294,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "1000"
+        mask: "1000"
   - entity: switch
   - entity: switch
     name: Eco mode
     name: Eco mode
     category: config
     category: config
@@ -309,8 +303,7 @@ secondary_entities:
       - id: 123
       - id: 123
         type: hex
         type: hex
         name: switch
         name: switch
-        mapping:
-          - mask: "0001"
+        mask: "0001"
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 18 - 18
custom_components/tuya_local/devices/tera_w01_evcharger.yaml

@@ -66,9 +66,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: L1 Current
     name: L1 Current
     class: current
     class: current
@@ -79,9 +79,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: L1 Power
     name: L1 Power
     class: power
     class: power
@@ -92,9 +92,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: L2 Voltage
     name: L2 Voltage
     class: voltage
     class: voltage
@@ -105,9 +105,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: L2 Current
     name: L2 Current
     class: current
     class: current
@@ -118,9 +118,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: L2 Power
     name: L2 Power
     class: power
     class: power
@@ -131,9 +131,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: L3 Voltage
     name: L3 Voltage
     class: voltage
     class: voltage
@@ -144,9 +144,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: L3 Current
     name: L3 Current
     class: current
     class: current
@@ -157,9 +157,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: L3 Power
     name: L3 Power
     class: power
     class: power
@@ -170,9 +170,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     dps:
     dps:

+ 6 - 6
custom_components/tuya_local/devices/tompd_63lw_breaker.yaml

@@ -120,9 +120,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -133,9 +133,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -146,9 +146,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 9 - 9
custom_components/tuya_local/devices/tongou_qcb2_circuitbreaker.yaml

@@ -31,9 +31,9 @@ secondary_entities:
         unit: V
         unit: V
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -45,9 +45,9 @@ secondary_entities:
         unit: A
         unit: A
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -59,9 +59,9 @@ secondary_entities:
         unit: kW
         unit: kW
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -73,9 +73,9 @@ secondary_entities:
         unit: V
         unit: V
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -87,9 +87,9 @@ secondary_entities:
         unit: A
         unit: A
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -101,9 +101,9 @@ secondary_entities:
         unit: kW
         unit: kW
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -115,9 +115,9 @@ secondary_entities:
         unit: V
         unit: V
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -129,9 +129,9 @@ secondary_entities:
         unit: A
         unit: A
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -143,9 +143,9 @@ secondary_entities:
         unit: kW
         unit: kW
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: select
   - entity: select
     name: Overvoltage action
     name: Overvoltage action
     category: config
     category: config

+ 3 - 3
custom_components/tuya_local/devices/tongou_qcb2_singlephasebreaker.yaml

@@ -31,9 +31,9 @@ secondary_entities:
         unit: V
         unit: V
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -45,9 +45,9 @@ secondary_entities:
         unit: A
         unit: A
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -59,9 +59,9 @@ secondary_entities:
         unit: kW
         unit: kW
         class: measurement
         class: measurement
         optional: true
         optional: true
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: select
   - entity: select
     name: Overvoltage action
     name: Overvoltage action
     category: config
     category: config

+ 18 - 18
custom_components/tuya_local/devices/tongou_st463jwt_breaker.yaml

@@ -119,9 +119,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -132,9 +132,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -145,9 +145,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -158,9 +158,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -171,9 +171,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -184,9 +184,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -197,9 +197,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -210,9 +210,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -223,9 +223,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 6 - 6
custom_components/tuya_local/devices/tongou_toqsyswt_breaker.yaml

@@ -33,9 +33,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -46,9 +46,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -59,9 +59,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: switch
   - entity: switch
     name: Prepay
     name: Prepay
     icon: "mdi:cash"
     icon: "mdi:cash"

+ 30 - 114
custom_components/tuya_local/devices/tuya_000004rime_weather_station.yaml

@@ -23,43 +23,32 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 000000FF00000000000000000000000000
         mapping:
         mapping:
-          - mask: 000000FF00000000000000000000000000
           - dps_val: null
           - dps_val: null
             value: None
             value: None
           - dps_val: 0
           - dps_val: 0
             value: None
             value: None
-            mask: 000000FF00000000000000000000000000
           - dps_val: 1
           - dps_val: 1
             value: Sunny
             value: Sunny
-            mask: 000000FF00000000000000000000000000
           - dps_val: 2
           - dps_val: 2
             value: Cloudy
             value: Cloudy
-            mask: 000000FF00000000000000000000000000
           - dps_val: 3
           - dps_val: 3
             value: Sunny and cloudy
             value: Sunny and cloudy
-            mask: 000000FF00000000000000000000000000
           - dps_val: 4
           - dps_val: 4
             value: Cloudy and light rain
             value: Cloudy and light rain
-            mask: 000000FF00000000000000000000000000
           - dps_val: 5
           - dps_val: 5
             value: Cloudy and moderate rain
             value: Cloudy and moderate rain
-            mask: 000000FF00000000000000000000000000
           - dps_val: 6
           - dps_val: 6
             value: Cloudy and heavy rain
             value: Cloudy and heavy rain
-            mask: 000000FF00000000000000000000000000
           - dps_val: 7
           - dps_val: 7
             value: Cloudy, rain and thunder
             value: Cloudy, rain and thunder
-            mask: 000000FF00000000000000000000000000
           - dps_val: 8
           - dps_val: 8
             value: Snowy
             value: Snowy
-            mask: 000000FF00000000000000000000000000
           - dps_val: 9
           - dps_val: 9
             value: Cloudy and snowy
             value: Cloudy and snowy
-            mask: 000000FF00000000000000000000000000
           - dps_val: 10
           - dps_val: 10
             value: Cloudy, rainy and snowy
             value: Cloudy, rainy and snowy
-            mask: 000000FF00000000000000000000000000
       - id: 103
       - id: 103
         optional: true
         optional: true
         type: base64
         type: base64
@@ -221,101 +210,77 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: year
         name: year
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: month
         name: month
+        mask: 00FF0000000000
         mapping:
         mapping:
-          - mask: 00FF0000000000
           - dps_val: 1
           - dps_val: 1
             value: January
             value: January
-            mask: 00FF0000000000
           - dps_val: 2
           - dps_val: 2
             value: February
             value: February
-            mask: 00FF0000000000
           - dps_val: 3
           - dps_val: 3
             value: March
             value: March
-            mask: 00FF0000000000
           - dps_val: 4
           - dps_val: 4
             value: April
             value: April
-            mask: 00FF0000000000
           - dps_val: 5
           - dps_val: 5
             value: May
             value: May
-            mask: 00FF0000000000
           - dps_val: 6
           - dps_val: 6
             value: June
             value: June
-            mask: 00FF0000000000
           - dps_val: 7
           - dps_val: 7
             value: July
             value: July
-            mask: 00FF0000000000
           - dps_val: 8
           - dps_val: 8
             value: August
             value: August
-            mask: 00FF0000000000
           - dps_val: 9
           - dps_val: 9
             value: September
             value: September
-            mask: 00FF0000000000
           - dps_val: 10
           - dps_val: 10
             value: October
             value: October
-            mask: 00FF0000000000
           - dps_val: 11
           - dps_val: 11
             value: November
             value: November
-            mask: 00FF0000000000
           - dps_val: 12
           - dps_val: 12
             value: December
             value: December
-            mask: 00FF0000000000
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: day
         name: day
-        mapping:
-          - mask: "0000FF00000000"
+        mask: "0000FF00000000"
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: hour
         name: hour
-        mapping:
-          - mask: "000000FF000000"
+        mask: "000000FF000000"
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: minute
         name: minute
-        mapping:
-          - mask: "00000000FF0000"
+        mask: "00000000FF0000"
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: second
         name: second
-        mapping:
-          - mask: "0000000000FF00"
+        mask: "0000000000FF00"
       - id: 101
       - id: 101
         optional: true
         optional: true
         type: base64
         type: base64
         name: weekday
         name: weekday
+        mask: "000000000000FF"
         mapping:
         mapping:
-          - mask: "000000000000FF"
           - dps_val: 1
           - dps_val: 1
             value: Monday
             value: Monday
-            mask: 00FF0000000000
           - dps_val: 2
           - dps_val: 2
             value: Tuesday
             value: Tuesday
-            mask: 00FF0000000000
           - dps_val: 3
           - dps_val: 3
             value: Wednesday
             value: Wednesday
-            mask: 00FF0000000000
           - dps_val: 4
           - dps_val: 4
             value: Thursday
             value: Thursday
-            mask: 00FF0000000000
           - dps_val: 5
           - dps_val: 5
             value: Friday
             value: Friday
-            mask: 00FF0000000000
           - dps_val: 6
           - dps_val: 6
             value: Saturday
             value: Saturday
-            mask: 00FF0000000000
           - dps_val: 7
           - dps_val: 7
             value: Sunday
             value: Sunday
-            mask: 00FF0000000000
   - entity: switch
   - entity: switch
     name: LCD night mode
     name: LCD night mode
     icon: "mdi:weather-night"
     icon: "mdi:weather-night"
@@ -332,26 +297,22 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: start_hour
         name: start_hour
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 130
       - id: 130
         optional: true
         optional: true
         type: base64
         type: base64
         name: start_minute
         name: start_minute
-        mapping:
-          - mask: "00FF0000"
+        mask: "00FF0000"
       - id: 130
       - id: 130
         optional: true
         optional: true
         type: base64
         type: base64
         name: end_hour
         name: end_hour
-        mapping:
-          - mask: "0000FF00"
+        mask: "0000FF00"
       - id: 130
       - id: 130
         optional: true
         optional: true
         type: base64
         type: base64
         name: end_minute
         name: end_minute
-        mapping:
-          - mask: "000000FF"
+        mask: "000000FF"
   # diagnostic section, base64 dps
   # diagnostic section, base64 dps
   - entity: binary_sensor
   - entity: binary_sensor
     category: diagnostic
     category: diagnostic
@@ -374,134 +335,112 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: uv_index
         name: uv_index
+        mask: FF00000000000000000000
         mapping:
         mapping:
-          - mask: FF00000000000000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: FF00000000000000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: FF00000000000000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: sunrise_sunset
         name: sunrise_sunset
+        mask: 00FF000000000000000000
         mapping:
         mapping:
-          - mask: 00FF000000000000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 00FF000000000000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 00FF000000000000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: three_day_forecast_temperature
         name: three_day_forecast_temperature
+        mask: 0000FF0000000000000000
         mapping:
         mapping:
-          - mask: 0000FF0000000000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 0000FF0000000000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 0000FF0000000000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: hourly_forecast
         name: hourly_forecast
+        mask: 000000FF00000000000000
         mapping:
         mapping:
-          - mask: 000000FF00000000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 000000FF00000000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 000000FF00000000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: three_day_forecast_weather
         name: three_day_forecast_weather
+        mask: 00000000FF000000000000
         mapping:
         mapping:
-          - mask: 00000000FF000000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 00000000FF000000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 00000000FF000000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: local_temperature_humidity
         name: local_temperature_humidity
+        mask: 0000000000FF0000000000
         mapping:
         mapping:
-          - mask: 0000000000FF0000000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 0000000000FF0000000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 0000000000FF0000000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: date
         name: date
+        mask: 000000000000FF00000000
         mapping:
         mapping:
-          - mask: 000000000000FF00000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 000000000000FF00000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 000000000000FF00000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: week
         name: week
+        mask: 00000000000000FF000000
         mapping:
         mapping:
-          - mask: 00000000000000FF000000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 00000000000000FF000000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 00000000000000FF000000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: hourly_forecast_weather
         name: hourly_forecast_weather
+        mask: 0000000000000000FF0000
         mapping:
         mapping:
-          - mask: 0000000000000000FF0000
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 0000000000000000FF0000
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 0000000000000000FF0000
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor_1_temperature_humidity
         name: sensor_1_temperature_humidity
+        mask: 000000000000000000FF00
         mapping:
         mapping:
-          - mask: 000000000000000000FF00
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 000000000000000000FF00
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 000000000000000000FF00
       - id: 108
       - id: 108
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor_2_temperature_humidity
         name: sensor_2_temperature_humidity
+        mask: 00000000000000000000FF
         mapping:
         mapping:
-          - mask: 00000000000000000000FF
           - dps_val: 1
           - dps_val: 1
             value: true
             value: true
-            mask: 00000000000000000000FF
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
-            mask: 00000000000000000000FF
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Device status
     name: Device status
@@ -511,14 +450,12 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: FF000000000000
         mapping:
         mapping:
-          - mask: FF000000000000
           - dps_val: 0
           - dps_val: 0
             value: Offline
             value: Offline
-            mask: FF000000000000
           - dps_val: 1
           - dps_val: 1
             value: Online
             value: Online
-            mask: FF000000000000
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 1 status
     name: Sensor 1 status
@@ -528,20 +465,16 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 00FF0000000000
         mapping:
         mapping:
-          - mask: 00FF0000000000
           - dps_val: 0
           - dps_val: 0
             value: Offline
             value: Offline
-            mask: 00FF0000000000
           - dps_val: 1
           - dps_val: 1
             value: Online
             value: Online
-            mask: 00FF0000000000
           - dps_val: 2
           - dps_val: 2
             value: Unpaired
             value: Unpaired
-            mask: 00FF0000000000
           - dps_val: 3
           - dps_val: 3
             value: None
             value: None
-            mask: 00FF0000000000
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 2 status
     name: Sensor 2 status
@@ -551,20 +484,16 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 0000FF00000000
         mapping:
         mapping:
-          - mask: 0000FF00000000
           - dps_val: 0
           - dps_val: 0
             value: Offline
             value: Offline
-            mask: 0000FF00000000
           - dps_val: 1
           - dps_val: 1
             value: Online
             value: Online
-            mask: 0000FF00000000
           - dps_val: 2
           - dps_val: 2
             value: Unpaired
             value: Unpaired
-            mask: 0000FF00000000
           - dps_val: 3
           - dps_val: 3
             value: None
             value: None
-            mask: 0000FF00000000
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 3 status
     name: Sensor 3 status
@@ -574,20 +503,16 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 000000FF000000
         mapping:
         mapping:
-          - mask: 000000FF000000
           - dps_val: 0
           - dps_val: 0
             value: Offline
             value: Offline
-            mask: 000000FF000000
           - dps_val: 1
           - dps_val: 1
             value: Online
             value: Online
-            mask: 000000FF000000
           - dps_val: 2
           - dps_val: 2
             value: Unpaired
             value: Unpaired
-            mask: 000000FF000000
           - dps_val: 3
           - dps_val: 3
             value: None
             value: None
-            mask: 000000FF000000
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 1 batery status
     name: Sensor 1 batery status
@@ -597,17 +522,14 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 00000000FF0000
         mapping:
         mapping:
-          - mask: 00000000FF0000
           - dps_val: 0
           - dps_val: 0
             value: Low
             value: Low
-            mask: 00000000FF0000
           - dps_val: 1
           - dps_val: 1
             value: Normal
             value: Normal
-            mask: 00000000FF0000
           - dps_val: 2
           - dps_val: 2
             value: None
             value: None
-            mask: 00000000FF0000
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 2 batery status
     name: Sensor 2 batery status
@@ -617,17 +539,14 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 0000000000FF00
         mapping:
         mapping:
-          - mask: 0000000000FF00
           - dps_val: 0
           - dps_val: 0
             value: Low
             value: Low
-            mask: 0000000000FF00
           - dps_val: 1
           - dps_val: 1
             value: Normal
             value: Normal
-            mask: 0000000000FF00
           - dps_val: 2
           - dps_val: 2
             value: None
             value: None
-            mask: 0000000000FF00
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     name: Sensor 3 batery status
     name: Sensor 3 batery status
@@ -637,17 +556,14 @@ secondary_entities:
         optional: true
         optional: true
         type: base64
         type: base64
         name: sensor
         name: sensor
+        mask: 000000000000FF
         mapping:
         mapping:
-          - mask: 000000000000FF
           - dps_val: 0
           - dps_val: 0
             value: Low
             value: Low
-            mask: 000000000000FF
           - dps_val: 1
           - dps_val: 1
             value: Normal
             value: Normal
-            mask: 000000000000FF
           - dps_val: 2
           - dps_val: 2
             value: None
             value: None
-            mask: 000000000000FF
   - entity: binary_sensor
   - entity: binary_sensor
     category: diagnostic
     category: diagnostic
     class: problem
     class: problem

+ 3 - 3
custom_components/tuya_local/devices/vevor_ev_charger.yaml

@@ -85,9 +85,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     class: voltage
     class: voltage
     category: diagnostic
     category: diagnostic
@@ -97,9 +97,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -109,9 +109,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic

+ 3 - 3
custom_components/tuya_local/devices/vevor_l2_ev_charger.yaml

@@ -67,9 +67,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000000000FFFFFF"
       - id: 9
       - id: 9
         type: integer
         type: integer
         name: total_power
         name: total_power
@@ -84,9 +84,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF000000000000"
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -96,9 +96,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
           - scale: 1000
           - scale: 1000
-            mask: "0000FFFFFF000000"
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 2 - 4
custom_components/tuya_local/devices/wadapower_q8_evcharger.yaml

@@ -112,8 +112,7 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         optional: true
         optional: true
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
   - entity: sensor
   - entity: sensor
     name: Scheduled stop hour
     name: Scheduled stop hour
     icon: "mdi:battery-clock-outline"
     icon: "mdi:battery-clock-outline"
@@ -122,8 +121,7 @@ secondary_entities:
         type: base64
         type: base64
         name: sensor
         name: sensor
         optional: true
         optional: true
-        mapping:
-          - mask: "00FF"
+        mask: "00FF"
   - entity: sensor
   - entity: sensor
     name: Fault reason
     name: Fault reason
     icon: 'mdi:alert-outline'
     icon: 'mdi:alert-outline'

+ 18 - 18
custom_components/tuya_local/devices/wdyk_2p63a_energy_meter.yaml

@@ -154,9 +154,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFF0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -167,9 +167,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF0000000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF0000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -180,9 +180,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF0000"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -193,9 +193,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -206,9 +206,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -219,9 +219,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -232,9 +232,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -245,9 +245,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -258,9 +258,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: number
   - entity: number
     name: Overvoltage threshold
     name: Overvoltage threshold
     category: config
     category: config

+ 13 - 13
custom_components/tuya_local/devices/wdyk_3phase_energymonitor.yaml

@@ -81,9 +81,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "FFFF00000000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "FFFF00000000"
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -96,9 +96,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "0000FFFF0000"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "0000FFFF0000"
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -111,9 +111,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "00000000FFFF"
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-            mask: "00000000FFFF"
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -126,9 +126,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "FFFFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFF000000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -141,9 +141,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "000000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "000000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -156,9 +156,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "000000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "000000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Total power
     name: Total power
     class: power
     class: power
@@ -171,9 +171,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "FFFFFF000000000000000000"
         mapping:
         mapping:
           - scale: 10000
           - scale: 10000
-            mask: "FFFFFF000000000000000000"
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -186,9 +186,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "000000FFFFFF000000000000"
         mapping:
         mapping:
           - scale: 10000
           - scale: 10000
-            mask: "000000FFFFFF000000000000"
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -201,9 +201,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "000000000000FFFFFF000000"
         mapping:
         mapping:
           - scale: 10000
           - scale: 10000
-            mask: "000000000000FFFFFF000000"
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -216,9 +216,9 @@ secondary_entities:
         class: measurement
         class: measurement
         optional: true
         optional: true
         force: true
         force: true
+        mask: "000000000000000000FFFFFF"
         mapping:
         mapping:
           - scale: 10000
           - scale: 10000
-            mask: "000000000000000000FFFFFF"
   - entity: sensor
   - entity: sensor
     name: Leakage current
     name: Leakage current
     class: current
     class: current

+ 18 - 18
custom_components/tuya_local/devices/wdyk_4p100a_energymeter.yaml

@@ -146,9 +146,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFFFF0000000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFF0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -159,9 +159,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFFFF0000000000"
         mapping:
         mapping:
-          - mask: "000000FFFFFF0000000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -172,9 +172,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "000000000000FFFFFF0000"
         mapping:
         mapping:
-          - mask: "000000000000FFFFFF0000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -185,9 +185,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -198,9 +198,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "000000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -211,9 +211,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "000000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "000000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -224,9 +224,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: V
         unit: V
+        mask: "FFFFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -237,9 +237,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: A
         unit: A
+        mask: "000000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "000000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -250,9 +250,9 @@ secondary_entities:
         name: sensor
         name: sensor
         optional: true
         optional: true
         unit: kW
         unit: kW
+        mask: "000000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "000000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: number
   - entity: number
     name: Overvoltage threshold
     name: Overvoltage threshold
     category: config
     category: config

+ 18 - 18
custom_components/tuya_local/devices/yagusmart_3pn_energymeter.yaml

@@ -106,9 +106,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current A
     name: Current A
     class: current
     class: current
@@ -120,9 +120,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         class: measurement
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power A
     name: Power A
     class: power
     class: power
@@ -134,9 +134,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage B
     name: Voltage B
     class: voltage
     class: voltage
@@ -148,9 +148,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current B
     name: Current B
     class: current
     class: current
@@ -162,9 +162,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         class: measurement
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power B
     name: Power B
     class: power
     class: power
@@ -176,9 +176,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Voltage C
     name: Voltage C
     class: voltage
     class: voltage
@@ -190,9 +190,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     name: Current C
     name: Current C
     class: current
     class: current
@@ -204,9 +204,9 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: A
         unit: A
         class: measurement
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     name: Power C
     name: Power C
     class: power
     class: power
@@ -218,6 +218,6 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000

+ 6 - 6
custom_components/tuya_local/devices/zm_wifi_smartmeter.yaml

@@ -30,9 +30,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: V
         unit: V
         class: measurement
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic
@@ -43,9 +43,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: A
         unit: A
         class: measurement
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
   - entity: sensor
     class: power
     class: power
     category: diagnostic
     category: diagnostic
@@ -56,9 +56,9 @@ secondary_entities:
         optional: true
         optional: true
         unit: kW
         unit: kW
         class: measurement
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic

+ 17 - 20
custom_components/tuya_local/helpers/device_config.py

@@ -410,27 +410,23 @@ class TuyaDpsConfig:
 
 
         return None
         return None
 
 
-    def mask(self, device):
-        mapping = self._find_map_for_dps(device.get_property(self.id))
-        if mapping:
-            mask = mapping.get("mask")
-            if mask:
-                return int(mask, 16)
+    @property
+    def mask(self):
+        mask = self._config.get("mask")
+        if mask:
+            return int(mask, 16)
 
 
-    def endianness(self, device):
-        mapping = self._find_map_for_dps(device.get_property(self.id))
-        if mapping:
-            endianness = mapping.get("endianness")
-            if endianness:
-                return endianness
-        return "big"
+    @property
+    def endianness(self):
+        endianness = self._config.get("endianness", "big")
+        return endianness
 
 
     def get_value(self, device):
     def get_value(self, device):
         """Return the value of the dps from the given device."""
         """Return the value of the dps from the given device."""
-        mask = self.mask(device)
+        mask = self.mask
         bytevalue = self.decoded_value(device)
         bytevalue = self.decoded_value(device)
         if mask and isinstance(bytevalue, bytes):
         if mask and isinstance(bytevalue, bytes):
-            value = int.from_bytes(bytevalue, self.endianness(device))
+            value = int.from_bytes(bytevalue, self.endianness)
             scale = mask & (1 + ~mask)
             scale = mask & (1 + ~mask)
             return self._map_from_dps((value & mask) // scale, device)
             return self._map_from_dps((value & mask) // scale, device)
         else:
         else:
@@ -858,13 +854,11 @@ class TuyaDpsConfig:
 
 
         mapping = self._find_map_for_value(value, device)
         mapping = self._find_map_for_value(value, device)
         scale = self.scale(device)
         scale = self.scale(device)
-        mask = None
+        mask = self.mask
         if mapping:
         if mapping:
             replaced = False
             replaced = False
             redirect = mapping.get("value_redirect")
             redirect = mapping.get("value_redirect")
             invert = mapping.get("invert", False)
             invert = mapping.get("invert", False)
-            mask = mapping.get("mask")
-            endianness = mapping.get("endianness", "big")
             target_range = mapping.get("target_range")
             target_range = mapping.get("target_range")
             step = mapping.get("step")
             step = mapping.get("step")
             if not isinstance(step, Number):
             if not isinstance(step, Number):
@@ -974,12 +968,15 @@ class TuyaDpsConfig:
                 mn = r[0]
                 mn = r[0]
                 mx = r[1]
                 mx = r[1]
                 raise ValueError(f"{self.name} ({value}) must be between {mn} and {mx}")
                 raise ValueError(f"{self.name} ({value}) must be between {mn} and {mx}")
+        if mask and isinstance(result, bool):
+            result = int(result)
 
 
         if mask and isinstance(result, Number):
         if mask and isinstance(result, Number):
             # mask is in hex, 2 digits/characters per byte
             # mask is in hex, 2 digits/characters per byte
-            length = int(len(mask) / 2)
+            hex_mask = self._config.get("mask")
+            length = int(len(hex_mask) / 2)
             # Convert to int
             # Convert to int
-            mask = int(mask, 16)
+            endianness = self.endianness
             mask_scale = mask & (1 + ~mask)
             mask_scale = mask & (1 + ~mask)
             current_value = int.from_bytes(self.decoded_value(device), endianness)
             current_value = int.from_bytes(self.decoded_value(device), endianness)
             result = (current_value & ~mask) | (mask & int(result * mask_scale))
             result = (current_value & ~mask) | (mask & int(result * mask_scale))

+ 4 - 8
tests/test_device_config.py

@@ -44,8 +44,6 @@ CONDMAP_SCHEMA = vol.Schema(
         },
         },
         vol.Optional("scale"): vol.Any(int, float),
         vol.Optional("scale"): vol.Any(int, float),
         vol.Optional("step"): vol.Any(int, float),
         vol.Optional("step"): vol.Any(int, float),
-        vol.Optional("mask"): str,
-        vol.Optional("endianness"): str,
         vol.Optional("invert"): True,
         vol.Optional("invert"): True,
         vol.Optional("unit"): str,
         vol.Optional("unit"): str,
         vol.Optional("icon"): vol.Match(r"^mdi:"),
         vol.Optional("icon"): vol.Match(r"^mdi:"),
@@ -116,6 +114,8 @@ DP_SCHEMA = vol.Schema(
         vol.Optional("icon_priority"): int,
         vol.Optional("icon_priority"): int,
         vol.Optional("mapping"): [MAPPING_SCHEMA],
         vol.Optional("mapping"): [MAPPING_SCHEMA],
         vol.Optional("format"): [FORMAT_SCHEMA],
         vol.Optional("format"): [FORMAT_SCHEMA],
+        vol.Optional("mask"): str,
+        vol.Optional("endianness"): vol.In(["little"]),
     }
     }
 )
 )
 ENTITY_SCHEMA = vol.Schema(
 ENTITY_SCHEMA = vol.Schema(
@@ -735,9 +735,7 @@ class TestDeviceConfig(IsolatedAsyncioTestCase):
             "id": "1",
             "id": "1",
             "name": "test",
             "name": "test",
             "type": "hex",
             "type": "hex",
-            "mapping": [
-                {"mask": "ff00"},
-            ],
+            "mask": "ff00",
         }
         }
         mock_device = MagicMock()
         mock_device = MagicMock()
         mock_device.get_property.return_value = "babe"
         mock_device.get_property.return_value = "babe"
@@ -754,9 +752,7 @@ class TestDeviceConfig(IsolatedAsyncioTestCase):
             "id": "1",
             "id": "1",
             "name": "test",
             "name": "test",
             "type": "hex",
             "type": "hex",
-            "mapping": [
-                {"mask": "ff00"},
-            ],
+            "mask": "ff00",
         }
         }
         mock_device = MagicMock()
         mock_device = MagicMock()
         mock_device.get_property.return_value = "babe"
         mock_device.get_property.return_value = "babe"