Procházet zdrojové kódy

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 před 1 rokem
rodič
revize
076cb6b1d7
48 změnil soubory, kde provedl 818 přidání a 1152 odebrání
  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
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: current
     dps:
@@ -75,9 +75,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "000000FFFF000000"
         mapping:
-          - mask: "000000FFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     class: power
     dps:
@@ -87,9 +87,9 @@ secondary_entities:
         optional: true
         unit: kW
         class: measurement
+        mask: "000000000000FFFF"
         mapping:
-          - mask: "000000000000FFFF"
-            scale: 1000
+          - scale: 1000
           - dps_val: null
             value_redirect: total_power
       - id: 9

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

@@ -217,9 +217,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Phase A current
     class: current
@@ -229,9 +229,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "000000FFFF000000"
         mapping:
-          - mask: "000000FFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Phase A power
     class: power
@@ -241,6 +241,6 @@ secondary_entities:
         name: sensor
         optional: true
         unit: kW
+        mask: "000000000000FFFF"
         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:
         min: 0
         max: 1000
-      mapping:
-        - mask: "00000000FFFF"
+      mask: "00000000FFFF"
     - id: 6
       type: hex
       name: scene_data

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

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

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

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

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

@@ -225,8 +225,7 @@ secondary_entities:
       - id: 123
         type: hex
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
     name: Beep
     category: config
@@ -234,8 +233,7 @@ secondary_entities:
       - id: 123
         type: hex
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: binary_sensor
     class: problem
     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
         class: measurement
         name: sensor
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: current
     category: diagnostic
@@ -53,9 +53,9 @@ secondary_entities:
         type: base64
         unit: A
         name: sensor
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     class: power
     category: diagnostic
@@ -66,6 +66,6 @@ secondary_entities:
         type: base64
         unit: kW
         name: sensor
+        mask: "0000000000FFFFFF"
         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
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current A
     class: current
@@ -160,9 +160,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power A
     class: power
@@ -172,9 +172,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Voltage B
     class: voltage
@@ -184,9 +184,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current B
     class: current
@@ -196,9 +196,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power B
     class: power
@@ -208,9 +208,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Voltage C
     class: voltage
@@ -220,9 +220,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current C
     class: current
@@ -232,9 +232,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power C
     class: power
@@ -244,9 +244,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: kW
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     class: temperature
     category: diagnostic
@@ -308,8 +308,7 @@ secondary_entities:
         name: sensor
         optional: true
         unit: s
-        mapping:
-          - mask: "0000FFFF"
+        mask: "0000FFFF"
   - entity: select
     name: Mode
     icon: "mdi:cogs"
@@ -338,9 +337,9 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
+        mask: "FFFF0000"
         mapping:
-          - mask: "FFFF0000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Maximum current
     class: current
@@ -351,6 +350,6 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
+        mask: "0000FFFF"
         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
         optional: true
         unit: V
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current A
     class: current
@@ -115,9 +115,9 @@ secondary_entities:
         name: sensor
         optional: true
         unit: A
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power A
     class: power
@@ -128,6 +128,6 @@ secondary_entities:
         name: sensor
         optional: true
         unit: kW
+        mask: "0000000000FFFFFF"
         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
         type: hex
         name: switch
-        mapping:
-          - mask: "100000000000000000000000"
+        mask: "100000000000000000000000"
   - entity: light
     name: LED 2
     category: config
@@ -65,8 +64,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "010000000000000000000000"
+        mask: "010000000000000000000000"
   - entity: light
     name: LED 3
     category: config
@@ -74,8 +72,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "001000000000000000000000"
+        mask: "001000000000000000000000"
   - entity: light
     name: LED 4
     category: config
@@ -83,8 +80,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000100000000000000000000"
+        mask: "000100000000000000000000"
   - entity: light
     name: LED 5
     category: config
@@ -92,8 +88,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000010000000000000000000"
+        mask: "000010000000000000000000"
   - entity: light
     name: LED 6
     category: config
@@ -101,8 +96,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000001000000000000000000"
+        mask: "000001000000000000000000"
   - entity: light
     name: LED 7
     category: config
@@ -110,8 +104,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000100000000000000000"
+        mask: "000000100000000000000000"
   - entity: light
     name: LED 8
     category: config
@@ -119,8 +112,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000010000000000000000"
+        mask: "000000010000000000000000"
   - entity: light
     name: LED 9
     category: config
@@ -128,8 +120,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000001000000000000000"
+        mask: "000000001000000000000000"
   - entity: light
     name: LED 10
     category: config
@@ -137,8 +128,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000100000000000000"
+        mask: "000000000100000000000000"
   - entity: light
     name: LED 11
     category: config
@@ -146,8 +136,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000010000000000000"
+        mask: "000000000010000000000000"
   - entity: light
     name: LED 12
     category: config
@@ -155,8 +144,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000001000000000000"
+        mask: "000000000001000000000000"
   - entity: light
     name: LED 13
     category: config
@@ -164,8 +152,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000100000000000"
+        mask: "000000000000100000000000"
   - entity: light
     name: LED 14
     category: config
@@ -173,8 +160,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000010000000000"
+        mask: "000000000000010000000000"
   - entity: light
     name: LED 15
     category: config
@@ -182,8 +168,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000001000000000"
+        mask: "000000000000001000000000"
   - entity: light
     name: LED 16
     category: config
@@ -191,8 +176,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000100000000"
+        mask: "000000000000000100000000"
   - entity: light
     name: LED 17
     category: config
@@ -200,8 +184,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000010000000"
+        mask: "000000000000000010000000"
   - entity: light
     name: LED 18
     category: config
@@ -209,8 +192,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000001000000"
+        mask: "000000000000000001000000"
   - entity: light
     name: LED 19
     category: config
@@ -218,8 +200,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000000100000"
+        mask: "000000000000000000100000"
   - entity: light
     name: LED 20
     category: config
@@ -227,8 +208,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000000010000"
+        mask: "000000000000000000010000"
   - entity: light
     name: LED 21
     category: config
@@ -236,8 +216,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000000001000"
+        mask: "000000000000000000001000"
   - entity: light
     name: LED 22
     category: config
@@ -245,8 +224,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000000000100"
+        mask: "000000000000000000000100"
   - entity: light
     name: LED 23
     category: config
@@ -254,8 +232,7 @@ secondary_entities:
       - id: 104
         type: hex
         name: switch
-        mapping:
-          - mask: "000000000000000000000010"
+        mask: "000000000000000000000010"
   - entity: light
     name: LED 24
     category: config
@@ -263,5 +240,4 @@ secondary_entities:
       - id: 104
         type: hex
         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
         unit: V
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Phase A current
     class: current
@@ -105,9 +105,9 @@ secondary_entities:
         name: sensor
         unit: A
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Phase A power
     class: power
@@ -119,9 +119,9 @@ secondary_entities:
         name: sensor
         unit: kW
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Total power
     class: power

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

@@ -227,8 +227,7 @@ secondary_entities:
       - id: 123
         type: hex
         name: switch
-        mapping:
-          - mask: "0008"
+        mask: "0008"
   - entity: switch
     name: Beep
     category: config
@@ -236,8 +235,7 @@ secondary_entities:
       - id: 123
         type: hex
         name: switch
-        mapping:
-          - mask: "0010"
+        mask: "0010"
   - entity: sensor
     class: pm25
     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
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 110
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 110
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 110
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 110
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start B encoded
     category: diagnostic
@@ -168,32 +163,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 111
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 111
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 111
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 111
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start C encoded
     category: diagnostic
@@ -206,32 +196,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 112
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 112
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 112
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 112
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
     name: Watering delay
     translation_key: timer
@@ -302,122 +287,102 @@ secondary_entities:
         optional: true
         name: 10_days
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 121
         optional: true
         name: 10_days_256
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 121
         optional: true
         name: 9_days
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 121
         optional: true
         name: 9_days_256
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 121
         optional: true
         name: 8_days
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 121
         optional: true
         name: 8_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 121
         optional: true
         name: 7_days
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 121
         optional: true
         name: 7_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 121
         optional: true
         name: 6_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 121
         optional: true
         name: 6_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 121
         optional: true
         name: 5_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 121
         optional: true
         name: 5_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 121
         optional: true
         name: 4_days
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 121
         optional: true
         name: 4_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 121
         optional: true
         name: 3_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 121
         optional: true
         name: 3_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 121
         optional: true
         name: 2_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 121
         optional: true
         name: 2_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 121
         optional: true
         name: 1_day
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 121
         optional: true
         name: 1_day_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
     name: Temperature count encoded
     category: diagnostic
@@ -458,29 +423,24 @@ secondary_entities:
         optional: true
         name: minute
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 128
         optional: true
         name: hour
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 128
         optional: true
         name: day
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 128
         optional: true
         name: month
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 128
         optional: true
         name: year
         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
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 110
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 110
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 110
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 110
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start B 1 encoded
     category: diagnostic
@@ -190,32 +185,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 111
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 111
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 111
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 111
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start C 1 encoded
     category: diagnostic
@@ -228,32 +218,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 112
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 112
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 112
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 112
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
     name: Watering delay 1
     translation_key: timer
@@ -338,122 +323,102 @@ secondary_entities:
         optional: true
         name: 10_days
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 121
         optional: true
         name: 10_days_256
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 121
         optional: true
         name: 9_days
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 121
         optional: true
         name: 9_days_256
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 121
         optional: true
         name: 8_days
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 121
         optional: true
         name: 8_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 121
         optional: true
         name: 7_days
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 121
         optional: true
         name: 7_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 121
         optional: true
         name: 6_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 121
         optional: true
         name: 6_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 121
         optional: true
         name: 5_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 121
         optional: true
         name: 5_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 121
         optional: true
         name: 4_days
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 121
         optional: true
         name: 4_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 121
         optional: true
         name: 3_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 121
         optional: true
         name: 3_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 121
         optional: true
         name: 2_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 121
         optional: true
         name: 2_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 121
         optional: true
         name: 1_day
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 121
         optional: true
         name: 1_day_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
     name: Temperature count 1 encoded
     category: diagnostic
@@ -497,32 +462,27 @@ secondary_entities:
         optional: true
         name: minute
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 128
         optional: true
         name: hour
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 128
         optional: true
         name: day
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 128
         optional: true
         name: month
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 128
         optional: true
         name: year
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
   - entity: sensor
     name: Soil temperature 2
     class: temperature
@@ -605,32 +565,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 157
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 157
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 157
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 157
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start B 2 encoded
     category: diagnostic
@@ -643,32 +598,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 158
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 158
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 158
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 158
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: sensor
     name: Start C 2 encoded
     category: diagnostic
@@ -681,32 +631,27 @@ secondary_entities:
         optional: true
         name: days
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 159
         optional: true
         name: minutes_duration
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 159
         optional: true
         name: hours_duration
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 159
         optional: true
         name: minutes_start
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 159
         optional: true
         name: hours_start
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
   - entity: select
     name: Watering delay 2
     translation_key: timer
@@ -751,122 +696,102 @@ secondary_entities:
         optional: true
         name: 10_days
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 163
         optional: true
         name: 10_days_256
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 163
         optional: true
         name: 9_days
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 163
         optional: true
         name: 9_days_256
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 163
         optional: true
         name: 8_days
         type: base64
-        mapping:
-          - mask: "FF00000000"
+        mask: "FF00000000"
       - id: 163
         optional: true
         name: 8_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000"
+        mask: "FF0000000000"
       - id: 163
         optional: true
         name: 7_days
         type: base64
-        mapping:
-          - mask: "FF000000000000"
+        mask: "FF000000000000"
       - id: 163
         optional: true
         name: 7_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000"
+        mask: "FF00000000000000"
       - id: 163
         optional: true
         name: 6_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000"
+        mask: "FF0000000000000000"
       - id: 163
         optional: true
         name: 6_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000"
+        mask: "FF000000000000000000"
       - id: 163
         optional: true
         name: 5_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000"
+        mask: "FF00000000000000000000"
       - id: 163
         optional: true
         name: 5_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000"
+        mask: "FF0000000000000000000000"
       - id: 163
         optional: true
         name: 4_days
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000"
+        mask: "FF000000000000000000000000"
       - id: 163
         optional: true
         name: 4_days_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000"
+        mask: "FF00000000000000000000000000"
       - id: 163
         optional: true
         name: 3_days
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000"
+        mask: "FF0000000000000000000000000000"
       - id: 163
         optional: true
         name: 3_days_256
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000"
       - id: 163
         optional: true
         name: 2_days
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000"
       - id: 163
         optional: true
         name: 2_days_256
         type: base64
-        mapping:
-          - mask: "FF0000000000000000000000000000000000"
+        mask: "FF0000000000000000000000000000000000"
       - id: 163
         optional: true
         name: 1_day
         type: base64
-        mapping:
-          - mask: "FF000000000000000000000000000000000000"
+        mask: "FF000000000000000000000000000000000000"
       - id: 163
         optional: true
         name: 1_day_256
         type: base64
-        mapping:
-          - mask: "FF00000000000000000000000000000000000000"
+        mask: "FF00000000000000000000000000000000000000"
   - entity: sensor
     name: Temperature count 2 encoded
     category: diagnostic
@@ -902,29 +827,24 @@ secondary_entities:
         optional: true
         name: minute
         type: base64
-        mapping:
-          - mask: "FF"
+        mask: "FF"
       - id: 167
         optional: true
         name: hour
         type: base64
-        mapping:
-          - mask: "FF00"
+        mask: "FF00"
       - id: 167
         optional: true
         name: day
         type: base64
-        mapping:
-          - mask: "FF0000"
+        mask: "FF0000"
       - id: 167
         optional: true
         name: month
         type: base64
-        mapping:
-          - mask: "FF000000"
+        mask: "FF000000"
       - id: 167
         optional: true
         name: year
         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
       class: measurement
       optional: true
+      mask: FFFFFF
+      endianness: little
       mapping:
-        - mask: FFFFFF
-          endianness: little
-          scale: 100
+        - scale: 100
       unit: F
 secondary_entities:
   - entity: sensor
@@ -27,10 +27,10 @@ secondary_entities:
         name: sensor
         class: measurement
         optional: true
+        mask: FFFFFF00000000
+        endianness: little
         mapping:
           - scale: 100
-            mask: FFFFFF00000000
-            endianness: little
         unit: F
   - entity: sensor
     name: Temperature probe 3
@@ -41,10 +41,10 @@ secondary_entities:
         name: sensor
         class: measurement
         optional: true
+        mask: FFFFFF0000000000000000
+        endianness: little
         mapping:
           - scale: 100
-            mask: FFFFFF0000000000000000
-            endianness: little
         unit: F
   - entity: sensor
     name: Temperature probe 4
@@ -55,10 +55,10 @@ secondary_entities:
         name: sensor
         class: measurement
         optional: true
+        mask: FFFFFF000000000000000000000000
+        endianness: little
         mapping:
           - scale: 100
-            mask: FFFFFF000000000000000000000000
-            endianness: little
         unit: F
   - entity: binary_sensor
     class: power
@@ -144,14 +144,14 @@ secondary_entities:
         range:
           min: 0
           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:
-          # 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
     name: Preset temperature 2
     category: config
@@ -165,10 +165,10 @@ secondary_entities:
         range:
           min: 0
           max: 50000
+        mask: 0000FFFF00000000
+        endianness: little
         mapping:
-          - mask: 0000FFFF00000000
-            endianness: little
-            scale: 100
+          - scale: 100
   - entity: number
     name: Preset temperature 3
     category: config
@@ -182,10 +182,10 @@ secondary_entities:
         range:
           min: 0
           max: 50000
+        mask: 00000000FFFF0000
+        endianness: little
         mapping:
-          - mask: 00000000FFFF0000
-            endianness: little
-            scale: 100
+          - scale: 100
   - entity: number
     name: Preset temperature 4
     category: config
@@ -199,7 +199,7 @@ secondary_entities:
         range:
           min: 0
           max: 50000
+        mask: 000000000000FFFF
+        endianness: little
         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
       name: type
       persist: false
-      mapping:
-        - endianness: little
-          mask: "FF"
+      endianness: little
+      mask: "FF"
     - id: 114
       optional: true
       type: base64
       name: sensor
       unit: C
       class: measurement
+      endianness: little
+      mask: "FFFF00"
       mapping:
         - scale: 10
-          endianness: little
-          mask: "FFFF00"
           constraint: type
           conditions:
             - dps_val: 0
@@ -46,18 +45,17 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF"
+        endianness: little
+        mask: "FF"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true
@@ -70,19 +68,18 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: C
         class: measurement
+        endianness: little
+        mask: "FFFF0000000000000000000000"
         mapping:
           - scale: 10
-            endianness: little
-            mask: "FFFF0000000000000000000000"
             constraint: type
             conditions:
               - dps_val: 0
@@ -97,18 +94,17 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true
@@ -121,19 +117,18 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: C
         class: measurement
+        endianness: little
+        mask: "FFFF000000000000000000000000000000000000000000"
         mapping:
           - scale: 10
-            endianness: little
-            mask: "FFFF000000000000000000000000000000000000000000"
             constraint: type
             conditions:
               - dps_val: 0
@@ -148,18 +143,17 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF0000000000000000000000000000000000000000000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF0000000000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true
@@ -172,21 +166,19 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: >-
-              FF000000000000000000000000000000000000000000000000000000000000
+        endianness: little
+        mask: FF000000000000000000000000000000000000000000000000000000000000
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: C
         class: measurement
+        endianness: little
+        mask: >-
+          FFFF00000000000000000000000000000000000000000000000000000000000000
         mapping:
           - scale: 10
-            endianness: little
-            mask: >-
-              FFFF00000000000000000000000000000000000000000000000000000000000000
             constraint: type
             conditions:
               - dps_val: 0
@@ -201,20 +193,18 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: >-
-              FF000000000000000000000000000000000000000000000000000000000000
+        endianness: little
+        mask: FF000000000000000000000000000000000000000000000000000000000000
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000\
+          000000000000000000000000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000\
-              000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true
@@ -227,21 +217,20 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000\
-              000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000\
+          000000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: C
         class: measurement
+        endianness: little
+        mask: "FFFF00000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000"
         mapping:
           - scale: 10
-            endianness: little
-            mask: "FFFF00000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000"
             constraint: type
             conditions:
               - dps_val: 0
@@ -256,20 +245,19 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true
@@ -282,21 +270,20 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF000000000000000000000000000000000000000000\
-              0000000000000000000000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF000000000000000000000000000000000000000000\
+          0000000000000000000000000000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: C
         class: measurement
+        endianness: little
+        mask: "FFFF00000000000000000000000000000000000000000000000\
+          0000000000000000000000000000000000000000000000000000000"
         mapping:
           - scale: 10
-            endianness: little
-            mask: "FFFF00000000000000000000000000000000000000000000000\
-              0000000000000000000000000000000000000000000000000000000"
             constraint: type
             conditions:
               - dps_val: 0
@@ -311,20 +298,19 @@ secondary_entities:
         type: base64
         name: type
         persist: false
-        mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000"
       - id: 114
         optional: true
         type: base64
         name: sensor
         unit: "%"
+        endianness: little
+        mask: "FF00000000000000000000000000000000000000000000000000000000\
+          00000000000000000000000000000000000000000000000000000000000000"
         mapping:
-          - endianness: little
-            mask: "FF00000000000000000000000000000000000000000000000000000000\
-              00000000000000000000000000000000000000000000000000000000000000"
-            constraint: type
+          - constraint: type
             conditions:
               - dps_val: 0
                 invalid: true

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -110,11 +110,10 @@ secondary_entities:
         type: base64
         optional: true
         name: current_temperature
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 118
         type: string
         optional: true
@@ -198,11 +197,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -219,11 +217,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -240,11 +237,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -261,11 +257,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -282,11 +277,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -303,11 +297,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -324,11 +317,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -344,11 +336,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Secondary EEV opening
     category: diagnostic
@@ -357,11 +348,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Compressor current
     class: current
@@ -372,11 +362,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Heat sink temperature
     class: temperature
@@ -386,11 +375,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -408,11 +396,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: V
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Compressor frequency
     class: frequency
@@ -423,11 +410,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: Hz
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Fan 1 speed
     category: diagnostic
@@ -437,11 +423,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Fan 2 speed
     category: diagnostic
@@ -451,11 +436,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               0000000000000000"
   - entity: sensor
     class: pressure
     category: diagnostic
@@ -465,11 +449,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: bar
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               0000000000000000"
   - entity: sensor
     name: Low pressure gas temperature
     class: temperature
@@ -479,11 +462,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -501,12 +483,12 @@ secondary_entities:
         optional: true
         name: sensor
         unit: kW
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: volume_flow_rate
     category: diagnostic
@@ -516,12 +498,12 @@ secondary_entities:
         optional: true
         name: sensor
         unit: m³/h
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: current
     category: diagnostic
@@ -531,11 +513,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     class: voltage
     category: diagnostic
@@ -545,11 +526,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: V
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     class: power
     category: diagnostic
@@ -559,11 +539,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: W
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Coefficient of performance
     category: diagnostic
@@ -572,12 +551,12 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: number
     name: Pump speed
     category: config
@@ -586,11 +565,10 @@ secondary_entities:
         type: base64
         optional: true
         name: value
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         range:
           min: 0
           max: 100
@@ -602,8 +580,7 @@ secondary_entities:
         type: base64
         optional: true
         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
       optional: true
       name: current_temperature
-      mapping:
-        - mask: "000000000000000000000000000000000000000000000000\
-                 00000000FFFFFFFF00000000000000000000000000000000\
-                 000000000000000000000000000000000000000000000000\
-                 0000000000000000"
+      mask: "000000000000000000000000000000000000000000000000\
+             00000000FFFFFFFF00000000000000000000000000000000\
+             000000000000000000000000000000000000000000000000\
+             0000000000000000"
     - id: 118
       type: string
       optional: true
@@ -189,11 +188,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -210,11 +208,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -231,11 +228,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -252,11 +248,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -273,11 +268,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -294,11 +288,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -315,11 +308,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -335,11 +327,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Secondary EEV opening
     category: diagnostic
@@ -348,11 +339,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Compressor current
     class: current
@@ -363,11 +353,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Heat sink temperature
     class: temperature
@@ -377,11 +366,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -399,11 +387,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: V
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Compressor frequency
     class: frequency
@@ -414,11 +401,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: Hz
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000FFFFFFFF00000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000FFFFFFFF00000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Fan 1 speed
     category: diagnostic
@@ -428,11 +414,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000FFFFFFFF000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000FFFFFFFF000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Fan 2 speed
     category: diagnostic
@@ -442,11 +427,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: rpm
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000FFFFFFFF0000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000FFFFFFFF0000000000000000\
+               0000000000000000"
   - entity: sensor
     class: pressure
     category: diagnostic
@@ -456,11 +440,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: bar
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   00000000000000000000000000000000FFFFFFFF00000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               00000000000000000000000000000000FFFFFFFF00000000\
+               0000000000000000"
   - entity: sensor
     name: Low pressure gas temperature
     class: temperature
@@ -470,11 +453,10 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000000000000000000000000000FFFFFFFF\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000000000000000000000000000FFFFFFFF\
+               0000000000000000"
       - id: 6
         type: string
         name: unit
@@ -492,12 +474,12 @@ secondary_entities:
         optional: true
         name: sensor
         unit: kW
+        mask: "FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: volume_flow_rate
     category: diagnostic
@@ -507,12 +489,12 @@ secondary_entities:
         optional: true
         name: sensor
         unit: m³/h
+        mask: "00000000FFFFFFFF00000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "00000000FFFFFFFF00000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: current
     category: diagnostic
@@ -522,11 +504,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: A
-        mapping:
-          - mask: "0000000000000000FFFFFFFF000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "0000000000000000FFFFFFFF000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     class: voltage
     category: diagnostic
@@ -536,11 +517,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: V
-        mapping:
-          - mask: "000000000000000000000000FFFFFFFF0000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000FFFFFFFF0000000000000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     class: power
     category: diagnostic
@@ -550,11 +530,10 @@ secondary_entities:
         optional: true
         name: sensor
         unit: W
-        mapping:
-          - mask: "00000000000000000000000000000000FFFFFFFF00000000\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "00000000000000000000000000000000FFFFFFFF00000000\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
   - entity: sensor
     name: Coefficient of performance
     category: diagnostic
@@ -563,12 +542,12 @@ secondary_entities:
         type: base64
         optional: true
         name: sensor
+        mask: "0000000000000000000000000000000000000000FFFFFFFF\
+               000000000000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         mapping:
-          - mask: "0000000000000000000000000000000000000000FFFFFFFF\
-                   000000000000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
-            scale: 10
+          - scale: 10
   - entity: number
     name: Pump speed
     category: config
@@ -577,11 +556,10 @@ secondary_entities:
         type: base64
         optional: true
         name: value
-        mapping:
-          - mask: "000000000000000000000000000000000000000000000000\
-                   FFFFFFFF0000000000000000000000000000000000000000\
-                   000000000000000000000000000000000000000000000000\
-                   0000000000000000"
+        mask: "000000000000000000000000000000000000000000000000\
+               FFFFFFFF0000000000000000000000000000000000000000\
+               000000000000000000000000000000000000000000000000\
+               0000000000000000"
         range:
           min: 0
           max: 100
@@ -593,8 +571,7 @@ secondary_entities:
         type: base64
         optional: true
         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
         type: base64
         name: switch
+        mask: FF0000
         mapping:
-          - mask: FF0000
           - dps_val: 0
             value: false
-            mask: FF0000
           - dps_val: 1
             value: true
-            mask: FF0000
   - entity: number
     name: Inching duration
     category: config
@@ -92,9 +90,8 @@ secondary_entities:
       - id: 44
         type: base64
         name: value
+        mask: 00FFFF
         unit: s
         range:
           min: 0
           max: 3600
-        mapping:
-          - mask: 00FFFF

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -106,9 +106,9 @@ secondary_entities:
         optional: true
         unit: V
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current A
     class: current
@@ -120,9 +120,9 @@ secondary_entities:
         name: sensor
         unit: A
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power A
     class: power
@@ -134,9 +134,9 @@ secondary_entities:
         name: sensor
         unit: kW
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Voltage B
     class: voltage
@@ -148,9 +148,9 @@ secondary_entities:
         optional: true
         unit: V
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current B
     class: current
@@ -162,9 +162,9 @@ secondary_entities:
         name: sensor
         unit: A
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power B
     class: power
@@ -176,9 +176,9 @@ secondary_entities:
         name: sensor
         unit: kW
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Voltage C
     class: voltage
@@ -190,9 +190,9 @@ secondary_entities:
         optional: true
         unit: V
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     name: Current C
     class: current
@@ -204,9 +204,9 @@ secondary_entities:
         name: sensor
         unit: A
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     name: Power C
     class: power
@@ -218,6 +218,6 @@ secondary_entities:
         name: sensor
         unit: kW
         class: measurement
+        mask: "0000000000FFFFFF"
         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
         unit: V
         class: measurement
+        mask: "FFFF000000000000"
         mapping:
-          - mask: "FFFF000000000000"
-            scale: 10
+          - scale: 10
   - entity: sensor
     class: current
     category: diagnostic
@@ -43,9 +43,9 @@ secondary_entities:
         optional: true
         unit: A
         class: measurement
+        mask: "0000FFFFFF000000"
         mapping:
-          - mask: "0000FFFFFF000000"
-            scale: 1000
+          - scale: 1000
   - entity: sensor
     class: power
     category: diagnostic
@@ -56,9 +56,9 @@ secondary_entities:
         optional: true
         unit: kW
         class: measurement
+        mask: "0000000000FFFFFF"
         mapping:
-          - mask: "0000000000FFFFFF"
-            scale: 1000
+          - scale: 1000
   - entity: binary_sensor
     class: problem
     category: diagnostic

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

@@ -410,27 +410,23 @@ class TuyaDpsConfig:
 
         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):
         """Return the value of the dps from the given device."""
-        mask = self.mask(device)
+        mask = self.mask
         bytevalue = self.decoded_value(device)
         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)
             return self._map_from_dps((value & mask) // scale, device)
         else:
@@ -858,13 +854,11 @@ class TuyaDpsConfig:
 
         mapping = self._find_map_for_value(value, device)
         scale = self.scale(device)
-        mask = None
+        mask = self.mask
         if mapping:
             replaced = False
             redirect = mapping.get("value_redirect")
             invert = mapping.get("invert", False)
-            mask = mapping.get("mask")
-            endianness = mapping.get("endianness", "big")
             target_range = mapping.get("target_range")
             step = mapping.get("step")
             if not isinstance(step, Number):
@@ -974,12 +968,15 @@ class TuyaDpsConfig:
                 mn = r[0]
                 mx = r[1]
                 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):
             # 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
-            mask = int(mask, 16)
+            endianness = self.endianness
             mask_scale = mask & (1 + ~mask)
             current_value = int.from_bytes(self.decoded_value(device), endianness)
             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("step"): vol.Any(int, float),
-        vol.Optional("mask"): str,
-        vol.Optional("endianness"): str,
         vol.Optional("invert"): True,
         vol.Optional("unit"): str,
         vol.Optional("icon"): vol.Match(r"^mdi:"),
@@ -116,6 +114,8 @@ DP_SCHEMA = vol.Schema(
         vol.Optional("icon_priority"): int,
         vol.Optional("mapping"): [MAPPING_SCHEMA],
         vol.Optional("format"): [FORMAT_SCHEMA],
+        vol.Optional("mask"): str,
+        vol.Optional("endianness"): vol.In(["little"]),
     }
 )
 ENTITY_SCHEMA = vol.Schema(
@@ -735,9 +735,7 @@ class TestDeviceConfig(IsolatedAsyncioTestCase):
             "id": "1",
             "name": "test",
             "type": "hex",
-            "mapping": [
-                {"mask": "ff00"},
-            ],
+            "mask": "ff00",
         }
         mock_device = MagicMock()
         mock_device.get_property.return_value = "babe"
@@ -754,9 +752,7 @@ class TestDeviceConfig(IsolatedAsyncioTestCase):
             "id": "1",
             "name": "test",
             "type": "hex",
-            "mapping": [
-                {"mask": "ff00"},
-            ],
+            "mask": "ff00",
         }
         mock_device = MagicMock()
         mock_device.get_property.return_value = "babe"