Skip to content

Commit

Permalink
Add translations for Air quality sensors.
Browse files Browse the repository at this point in the history
Many devices have a textual Air quality sensor. Standardise the values
for those with mappings to the following 5 values so status can also
be translated:
   excellent, good, moderate, poor, severe

Generally this meant the following changes:

great -> excellent
fair, mild -> moderate
medium, mildly polluted -> poor

Although the last one may seem to fit moderate better, for some
sensors this was the most severe reading they had, for others there
was a severe (literally from the device), so a less extreme negative
seemed more appropriate.

Issue #1708
  • Loading branch information
make-all committed Jan 13, 2025
1 parent 627e07e commit 5f5c48c
Show file tree
Hide file tree
Showing 44 changed files with 308 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ products:
model: ZN-2C09
entities:
- entity: sensor
name: Air Quality
translation_key: air_quality
class: enum
icon: "mdi:factory"
dps:
- id: 1
type: string
name: sensor
mapping:
- dps_val: "level_1"
value: "Excellent"
- dps_val: "level_2"
value: "Good"
- dps_val: level_1
value: excellent
- dps_val: level_2
value: good
- dps_val: level_3
value: "Lightly polluted"
value: poor
- entity: sensor
class: temperature
dps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ entities:
type: integer
unit: min
- entity: sensor
name: Air quality
icon: "mdi:air-filter"
translation_key: air_quality
dps:
- id: 21
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,18 @@ entities:
type: integer
unit: min
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 22
name: sensor
type: string
mapping:
- dps_val: "great"
value: "Great"
- dps_val: "good"
value: "Good"
- dps_val: "medium"
value: "Medium"
- dps_val: "severe"
value: "Severe"
- dps_val: great
value: excellent
- dps_val: good
value: good
- dps_val: medium
value: poor
- dps_val: severe
value: severe
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ entities:
- dps_val: "4"
value: "8h"
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:factory"
category: diagnostic
dps:
- id: 22
type: string
name: sensor
mapping:
- dps_val: "1"
value: Excellent
value: excellent
- dps_val: "2"
value: Good
value: good
- dps_val: "3"
value: Fair
value: moderate
- dps_val: "4"
value: Poor
value: poor
15 changes: 7 additions & 8 deletions custom_components/tuya_local/devices/duux_bright_purifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,17 @@ entities:
- dps_val: "8h"
value: "8h"
- entity: sensor
name: Air quality
icon: "mdi:air-filter"
translation_key: air_quality
class: enum
category: diagnostic
dps:
- id: 21
type: string
name: sensor
mapping:
- dps_val: "great"
value: "Great"
- dps_val: "good"
value: "Good"
- dps_val: "poor"
value: "Poor"
- dps_val: great
value: excellent
- dps_val: good
value: good
- dps_val: poor
value: poor
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ entities:
class: measurement
unit: ugm3
- entity: sensor
name: Air quality
translation_key: air_quality
dps:
- id: 21
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ entities:
value: true
- value: false
- entity: sensor
name: Air quality
translation_key: air_quality
dps:
- id: 125
name: sensor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ entities:
- dps_val: 8h
value: "8h"
- entity: sensor
name: Air quality
translation_key: air_quality
dps:
- id: 21
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ entities:
name: sensor
unit: "min"
- entity: sensor
name: Air quality
translation_key: air_quality
dps:
- id: 22
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ entities:
value: "On"
- entity: sensor
category: diagnostic
name: Air quality
icon: "mdi:weather-dust"
translation_key: air_quality
dps:
- id: 108
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ products:
name: 7in1 air quality meter
entities:
- entity: sensor
name: Air quality
icon: "mdi:factory"
translation_key: air_quality
dps:
- id: 21
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ entities:
unit: "%"
class: measurement
- entity: sensor
name: Air quality
translation_key: air_quality
dps:
- id: 21
type: string
Expand Down
19 changes: 9 additions & 10 deletions custom_components/tuya_local/devices/kogan_air_purifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,18 @@ entities:
type: integer
unit: min
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 22
name: sensor
type: string
mapping:
- dps_val: 1
value: "Good"
- dps_val: 2
value: "Normal"
- dps_val: 3
value: "Poor"
- dps_val: 4
value: "Severe"
- dps_val: "1"
value: good
- dps_val: "2"
value: moderate
- dps_val: "3"
value: poor
- dps_val: "4"
value: severe
15 changes: 7 additions & 8 deletions custom_components/tuya_local/devices/morento_hy4866_wf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@ entities:
- dps_val: "8H"
value: "8h"
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 21
name: sensor
type: string
mapping:
- dps_val: "good"
value: "Good"
- dps_val: "medium"
value: "Medium"
- dps_val: "severe"
value: "Severe"
- dps_val: good
value: good
- dps_val: medium
value: poor
- dps_val: severe
value: severe
15 changes: 7 additions & 8 deletions custom_components/tuya_local/devices/nx_100ap_air_purifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,19 @@ entities:
type: integer
unit: min
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 21
name: sensor
type: string
mapping:
- dps_val: "good"
value: "Good"
- dps_val: "medium"
value: "Medium"
- dps_val: "severe"
value: "Severe"
- dps_val: good
value: good
- dps_val: medium
value: poor
- dps_val: severe
value: severe
- entity: sensor
class: pm25
dps:
Expand Down
19 changes: 9 additions & 10 deletions custom_components/tuya_local/devices/proscenic_a8_airpurifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,18 @@ entities:
optional: true
unit: ugm3
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 21
name: sensor
type: string
mapping:
- dps_val: "great"
value: "Great"
- dps_val: "good"
value: "Good"
- dps_val: "medium"
value: "Mild pollution"
- dps_val: "severe"
value: "Severe"
- dps_val: great
value: excellent
- dps_val: good
value: good
- dps_val: medium
value: poor
- dps_val: severe
value: severe
19 changes: 9 additions & 10 deletions custom_components/tuya_local/devices/proscenic_a9_airpurifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,21 @@ entities:
optional: true
unit:
- entity: sensor
name: Air quality
translation_key: air_quality
class: enum
icon: "mdi:air-filter"
dps:
- id: 21
name: sensor
type: string
mapping:
- dps_val: "mild"
value: "Great"
- dps_val: "good"
value: "Good"
- dps_val: "medium"
value: "Medium"
- dps_val: "severe"
value: "Severe"
- dps_val: mild
value: excellent
- dps_val: good
value: good
- dps_val: medium
value: poor
- dps_val: severe
value: severe
- entity: select
translation_key: timer
category: config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,24 @@ entities:
unit: µg/m³
class: measurement
# - entity: sensor
# name: Air Quality
# translation_key: air_quality
# class: enum
# dps:
# - id: 104
# type: string
# name: sensor
# optional: true
# mapping:
# - dps_val: "great"
# value: "Great"
# - dps_val: "mild"
# value: "Mild"
# - dps_val: "good"
# value: "Good"
# - dps_val: "medium"
# value: "Medium"
# - dps_val: "severe"
# value: "Severe"
# - dps_val: great
# value: excellent
# - dps_val: mild
# value: moderate
# - dps_val: good
# value: good
# - dps_val: medium
# value: poor
# - dps_val: severe
# value: severe
- entity: number
name: PM2.5 alarm threshold
category: config
Expand Down
Loading

0 comments on commit 5f5c48c

Please sign in to comment.