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

EM3378: unit selectors only seem to affect display

Data from the device is always using Fahrenheit and hPa.

Change pressure unit options to match the units instead of spelling them
out in English. This will be more translation friendly.

Issue #419
Jason Rumney 1 год назад
Родитель
Сommit
91c31fa73d
1 измененных файлов с 15 добавлено и 45 удалено
  1. 15 45
      custom_components/tuya_local/devices/em3378_weather_station.yaml

+ 15 - 45
custom_components/tuya_local/devices/em3378_weather_station.yaml

@@ -13,18 +13,7 @@ primary_entity:
       class: measurement
       class: measurement
       mapping:
       mapping:
         - scale: 10
         - scale: 10
-    - id: 112
-      type: boolean
-      name: unit
-      mapping:
-        - dps_val: true
-          value: F
-        - dps_val: false
-          value: C
-    - id: 117
-      name: fault
-      type: bitfield
-      optional: true
+      unit: F
       # we need the full range of values to expose this as a light control
       # we need the full range of values to expose this as a light control
     - id: 118
     - id: 118
       name: backlight_brightness
       name: backlight_brightness
@@ -35,7 +24,7 @@ primary_entity:
       # below is probably related to the built in USB charger, but is encoded
       # below is probably related to the built in USB charger, but is encoded
     - id: 122
     - id: 122
       name: output_power
       name: output_power
-      type: hex
+      type: string
 secondary_entities:
 secondary_entities:
   - entity: sensor
   - entity: sensor
     name: Indoor humidity
     name: Indoor humidity
@@ -57,14 +46,7 @@ secondary_entities:
         class: measurement
         class: measurement
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-      - id: 112
-        type: boolean
-        name: unit
-        mapping:
-          - dps_val: false
-            value: C
-          - dps_val: true
-            value: F
+        unit: F
   - entity: sensor
   - entity: sensor
     name: Remote humidity 1
     name: Remote humidity 1
     class: humidity
     class: humidity
@@ -87,14 +69,7 @@ secondary_entities:
         optional: true
         optional: true
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-      - id: 112
-        type: boolean
-        name: unit
-        mapping:
-          - dps_val: false
-            value: C
-          - dps_val: true
-            value: F
+        unit: F
   - entity: sensor
   - entity: sensor
     name: Remote humidity 2
     name: Remote humidity 2
     class: humidity
     class: humidity
@@ -118,14 +93,7 @@ secondary_entities:
         optional: true
         optional: true
         mapping:
         mapping:
           - scale: 10
           - scale: 10
-      - id: 112
-        type: boolean
-        name: unit
-        mapping:
-          - dps_val: false
-            value: C
-          - dps_val: true
-            value: F
+        unit: F
   - entity: sensor
   - entity: sensor
     name: Remote humidity 3
     name: Remote humidity 3
     class: humidity
     class: humidity
@@ -145,9 +113,7 @@ secondary_entities:
         type: integer
         type: integer
         name: sensor
         name: sensor
         class: measurement
         class: measurement
-      - id: 111
-        type: string
-        name: unit
+        unit: hPa
   - entity: select
   - entity: select
     name: Atmospheric pressure unit
     name: Atmospheric pressure unit
     icon: "mdi:gauge"
     icon: "mdi:gauge"
@@ -158,11 +124,11 @@ secondary_entities:
         name: option
         name: option
         mapping:
         mapping:
           - dps_val: mmHg
           - dps_val: mmHg
-            value: mm of mercury
+            value: mmHg
           - dps_val: hPa
           - dps_val: hPa
-            value: millibars
+            value: hPa
           - dps_val: inHg
           - dps_val: inHg
-            value: inches of mercury
+            value: inHg
   - entity: select
   - entity: select
     translation_key: temperature_unit
     translation_key: temperature_unit
     category: config
     category: config
@@ -171,9 +137,9 @@ secondary_entities:
         type: boolean
         type: boolean
         name: option
         name: option
         mapping:
         mapping:
-          - dps_val: false
-            value: celsius
           - dps_val: true
           - dps_val: true
+            value: celsius
+          - dps_val: false
             value: fahrenheit
             value: fahrenheit
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
@@ -190,6 +156,10 @@ secondary_entities:
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
           - value: true
           - value: true
+      - id: 117
+        name: fault_code
+        type: bitfield
+        optional: true
   - entity: select
   - entity: select
     name: Time mode
     name: Time mode
     icon: "mdi:clock-edit"
     icon: "mdi:clock-edit"