Skip to content

Commit 4d7864b

Browse files
authored
[airq] Add health/performance channels in percent, add UoM, refine unit hints and state patterns, make item labels consistent (openhab#16698)
Signed-off-by: Fabian Wolter <[email protected]>
1 parent e812d2d commit 4d7864b

File tree

5 files changed

+161
-76
lines changed

5 files changed

+161
-76
lines changed

bundles/org.openhab.binding.airq/README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,28 @@ The rw column is empty if the channel is only readable, w if the channel can be
5353
| fineDustCnt02_5 | Number:Dimensionless | | Fine Dust >2,5 µm |
5454
| fineDustCnt05 | Number:Dimensionless | | Fine Dust >5 µm |
5555
| fineDustCnt10 | Number:Dimensionless | | Fine Dust >10 µm |
56-
| co | Number | | CO concentration |
57-
| co2 | Number:Dimensionless | | CO₂ concentration |
56+
| co | Number:Density | | Carbon monoxide (CO) concentration |
57+
| co2 | Number:Dimensionless | | Carbon dioxide (CO₂) concentration |
5858
| dCO2dt | Number | | Change of CO₂ concentration |
5959
| dHdt | Number | | Change of Humidity |
6060
| dewpt | Number:Temperature | | Dew Point |
6161
| doorEvent | Number | | Door Event (experimental, might not work reliably) |
6262
| h2s | Number:Density | | Hydrogen sulfide (H₂S) |
63+
| healthIndex | Number:Dimensionless | | Health Index in percent |
6364
| health | Number:Dimensionless | | Health Index (0 to 1000, -200 for gas alarm, -800 for fire alarm) |
6465
| humidityRelative | Number:Dimensionless | | Humidity in percent |
65-
| humidityAbsolute | Number | | Absolute Humidity |
66+
| humidityAbsolute | Number:Density | | Absolute Humidity |
6667
| measureTime | Number:Time | | Milliseconds needed for measurement |
67-
| no2 | Number | | NO₂ concentration |
68-
| o3 | Number | | Ozone (O₃) concentration |
68+
| no2 | Number:Density | | Nitrogen Dioxide (NO₂) concentration |
69+
| o3 | Number:Density | | Ozone (O₃) concentration |
6970
| o2 | Number:Dimensionless | | Oxygen (O₂) concentration |
71+
| performanceIndex | Number:Dimensionless | | Performance Index in percent |
7072
| performance | Number:Dimensionless | | Performance Index (0 to 1000) |
7173
| fineDustConc01 | Number | | Fine Dust concentration >1 µm |
7274
| fineDustConc02_5 | Number | | Fine Dust concentration >2.5 µm |
7375
| fineDustConc10 | Number | | Fine Dust concentration >10 µm |
74-
| pressure | Number:Pressure | | Pressure |
75-
| so2 | Number | | SO₂ concentration |
76+
| pressure | Number:Pressure | | Barometric Pressure |
77+
| so2 | Number | | Sulfur dioxide (SO₂) concentration |
7678
| sound | Number:Dimensionless | | Noise |
7779
| temperature | Number:Temperature | | Temperature |
7880
| timestamp | DateTime | | Timestamp of measurement |

bundles/org.openhab.binding.airq/src/main/java/org/openhab/binding/airq/internal/AirqHandler.java

+6
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,10 @@ public void pollData() {
488488
processType(decObj, "dCO2dt", "dCO2dt", "number");
489489
processType(decObj, "dHdt", "dHdt", "number");
490490
processType(decObj, "door_event", "doorEvent", "number");
491+
processType(decObj, "health", "healthIndex", "index");
491492
processType(decObj, "health", "health", "number");
492493
processType(decObj, "measuretime", "measureTime", "number");
494+
processType(decObj, "performance", "performanceIndex", "index");
493495
processType(decObj, "performance", "performance", "number");
494496
processType(decObj, "timestamp", "timestamp", "datetime");
495497
processType(decObj, "uptime", "uptime", "numberTimePeriod");
@@ -626,6 +628,10 @@ private void processType(JsonObject dec, String airqName, String channelName, St
626628
updateState(channelName, new QuantityType<>(pairDB.getValue(), Units.DECIBEL));
627629
updateState(channelName + "_maxerr", new DecimalType(pairDB.getMaxdev()));
628630
break;
631+
case "index":
632+
double rawValue = Double.parseDouble(dec.get(airqName).toString());
633+
updateState(channelName, new QuantityType<>(rawValue / 10, Units.PERCENT));
634+
break;
629635
case "datetime":
630636
Long timest = Long.valueOf(dec.get(airqName).toString());
631637
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

bundles/org.openhab.binding.airq/src/main/resources/OH-INF/i18n/airq.properties

+20-18
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ channel-type.airq.WarmupPhase.label = Send data as in Warmup Phase
4444
channel-type.airq.Wifi.label = Use WLAN
4545
channel-type.airq.WifiInfo.label = Show WLAN Status with LED
4646
channel-type.airq.cloudUpload.label = Upload to air-Q Cloud
47-
channel-type.airq.cnt0_3.label = Fine Dust >0,3 μm
47+
channel-type.airq.cnt0_3.label = Fine Dust Count 0.3μm
4848
channel-type.airq.cnt0_3_maxerr.label = Max. Error Fine Dust >0,3μm
49-
channel-type.airq.cnt0_5.label = Fine Dust >0,5 μm
49+
channel-type.airq.cnt0_5.label = Fine Dust Count 0.5 μm
5050
channel-type.airq.cnt0_5_maxerr.label = Max. Error Fine Dust >0,5μm
51-
channel-type.airq.cnt1.label = Fine Dust >1 μm
52-
channel-type.airq.cnt10.label = Fine Dust >10 μm
51+
channel-type.airq.cnt1.label = Fine Dust Count 1μm
52+
channel-type.airq.cnt10.label = Fine Dust Count 10μm
5353
channel-type.airq.cnt10_maxerr.label = Max. Error Fine Dust >10μm
5454
channel-type.airq.cnt1_maxerr.label = Max. Error Fine Dust >1μm
55-
channel-type.airq.cnt2_5.label = Fine Dust >2,5 μm
55+
channel-type.airq.cnt2_5.label = Fine Dust Count 2.5μm
5656
channel-type.airq.cnt2_5_maxerr.label = Max. Error Fine Dust >2,5μm
57-
channel-type.airq.cnt5.label = Fine Dust >5 μm
57+
channel-type.airq.cnt5.label = Fine Dust Count 5μm
5858
channel-type.airq.cnt5_maxerr.label = Max. Error Fine Dust >5μm
59-
channel-type.airq.co.label = CO Concentration
60-
channel-type.airq.co2.label = CO₂ Concentration
59+
channel-type.airq.co.label = Carbon Monoxide (CO)
60+
channel-type.airq.co2.label = Carbon Dioxide (CO₂)
6161
channel-type.airq.co2_maxerr.label = Max. Error CO₂ Conc.
6262
channel-type.airq.co_maxerr.label = Max. Error CO Conc.
6363
channel-type.airq.dco2dt.label = Change of CO₂ Concentr.
@@ -69,7 +69,8 @@ channel-type.airq.door.label = Door Event (exp)
6969
channel-type.airq.geopos.label = Location of air-Q Device
7070
channel-type.airq.h2s.label = Hydrogen Sulfide (H₂S)
7171
channel-type.airq.h2s_maxerr.label = Max. Error H₂S Conc.
72-
channel-type.airq.health.label = Health Index
72+
channel-type.airq.health.label = Health Index Raw
73+
channel-type.airq.health_index.label = Health Index
7374
channel-type.airq.humidity.label = Humidity
7475
channel-type.airq.humidity_abs.label = Absolute Humidity
7576
channel-type.airq.humidity_abs_maxerr.label = Max. Error Abs. Humidity
@@ -81,22 +82,23 @@ channel-type.airq.nightmodeFanNightOff.label = Switch Off Fan at Night
8182
channel-type.airq.nightmodeStartDay.label = Start of Day Operation
8283
channel-type.airq.nightmodeStartNight.label = End of Day Operation
8384
channel-type.airq.nightmodeWifiNightOff.label = Switch Off WLAN at Night
84-
channel-type.airq.no2.label = NO₂ Concentration
85+
channel-type.airq.no2.label = Nitrogen Dioxide (NO₂)
8586
channel-type.airq.no2_maxerr.label = Max. Error NO₂ Conc.
86-
channel-type.airq.o3.label = O₃ Concentration
87+
channel-type.airq.o3.label = Ozone (O₃)
8788
channel-type.airq.o3_maxerr.label = Max. Error O₃ Conc.
88-
channel-type.airq.oxygen.label = Oxygen Concentration
89+
channel-type.airq.oxygen.label = Oxygen (O₂)
8990
channel-type.airq.oxygen_maxerr.label = Max. Error Oxygen Conc.
9091
channel-type.airq.pass.label = Device Password
91-
channel-type.airq.performance.label = Performance Index
92-
channel-type.airq.pm1.label = Fine Dust Concentr. >1μ
93-
channel-type.airq.pm10.label = Fine Dust Concentr. >10μ
92+
channel-type.airq.performance.label = Performance Index Raw
93+
channel-type.airq.performance_index.label = Performance Index
94+
channel-type.airq.pm1.label = Fine Dust 1μm
95+
channel-type.airq.pm10.label = Fine Dust 10μm
9496
channel-type.airq.pm10_maxerr.label = Max. Error Fine Dust Conc. >10μm
9597
channel-type.airq.pm1_maxerr.label = Max. Error Fine Dust Conc. >1μm
96-
channel-type.airq.pm2_5.label = Fine Dust Concentr. >2,5μ
98+
channel-type.airq.pm2_5.label = Fine Dust 2.5μm
9799
channel-type.airq.pm2_5_maxerr.label = Max. Error Fine Dust Conc. >2,5μm
98100
channel-type.airq.ppm_and_ppb.label = Values in Particles
99-
channel-type.airq.pressure.label = Pressure
101+
channel-type.airq.pressure.label = Barometric Pressure
100102
channel-type.airq.pressure_maxerr.label = Max. Error Pressure
101103
channel-type.airq.so2.label = SO₂ Concentration
102104
channel-type.airq.so2_maxerr.label = Max. Error SO₂ Conc.
@@ -106,7 +108,7 @@ channel-type.airq.status.label = Status of Sensors
106108
channel-type.airq.temperature.label = Temperature
107109
channel-type.airq.temperature_maxerr.label = Max. Error Temperature
108110
channel-type.airq.timestamp.label = Time Stamp
109-
channel-type.airq.tvoc.label = VOC Concentration
111+
channel-type.airq.tvoc.label = Volatile Organic Compounds (VOC)
110112
channel-type.airq.tvoc_maxerr.label = Max. Error VOC Conc.
111113
channel-type.airq.typps.label = Average Size of Fine Dust
112114
channel-type.airq.uptime.label = Uptime

bundles/org.openhab.binding.airq/src/main/resources/OH-INF/thing/thing-types.xml

+65-51
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
<channel id="dewpt" typeId="dewpt"/>
2626
<channel id="doorEvent" typeId="door"/>
2727
<channel id="h2s" typeId="h2s"/>
28+
<channel id="healthIndex" typeId="health_index"/>
2829
<channel id="health" typeId="health"/>
2930
<channel id="humidityRelative" typeId="humidity"/>
3031
<channel id="humidityAbsolute" typeId="humidity_abs"/>
3132
<channel id="measureTime" typeId="mtime"/>
3233
<channel id="no2" typeId="no2"/>
3334
<channel id="o3" typeId="o3"/>
3435
<channel id="o2" typeId="oxygen"/>
36+
<channel id="performanceIndex" typeId="performance_index"/>
3537
<channel id="performance" typeId="performance"/>
3638
<channel id="fineDustConc01" typeId="pm1"/>
3739
<channel id="fineDustConc02_5" typeId="pm2_5"/>
@@ -117,7 +119,7 @@
117119
<property name="sensorList">Unknown sensor list</property>
118120
<property name="sensorInfo">No info about sensors</property>
119121
<property name="industry">No industry info</property>
120-
<property name="thingTypeVersion">1</property>
122+
<property name="thingTypeVersion">2</property>
121123
</properties>
122124

123125
<config-description>
@@ -142,56 +144,56 @@
142144
</channel-type>
143145

144146
<channel-type id="typps" advanced="false">
145-
<item-type>Number:Length</item-type>
147+
<item-type unitHint="µm">Number:Length</item-type>
146148
<label>Average Size of Fine Dust</label>
147-
<state readOnly="true" pattern="%.2f μm"></state>
149+
<state readOnly="true" pattern="%.2f %unit%"></state>
148150
</channel-type>
149151

150-
<channel-type id="cnt0_3" advanced="false">
152+
<channel-type id="cnt0_3" advanced="true">
151153
<item-type>Number:Dimensionless</item-type>
152-
<label>Fine Dust >0,3 μm</label>
154+
<label>Fine Dust Count 0.3μm</label>
153155
<state readOnly="true" pattern="%.0f"></state>
154156
</channel-type>
155157

156-
<channel-type id="cnt0_5" advanced="false">
158+
<channel-type id="cnt0_5" advanced="true">
157159
<item-type>Number:Dimensionless</item-type>
158-
<label>Fine Dust >0,5 μm</label>
160+
<label>Fine Dust Count 0.5 μm</label>
159161
<state readOnly="true" pattern="%.0f"></state>
160162
</channel-type>
161163

162-
<channel-type id="cnt1" advanced="false">
164+
<channel-type id="cnt1" advanced="true">
163165
<item-type>Number:Dimensionless</item-type>
164-
<label>Fine Dust >1 μm</label>
166+
<label>Fine Dust Count 1μm</label>
165167
<state readOnly="true" pattern="%.0f"></state>
166168
</channel-type>
167169

168-
<channel-type id="cnt2_5" advanced="false">
170+
<channel-type id="cnt2_5" advanced="true">
169171
<item-type>Number:Dimensionless</item-type>
170-
<label>Fine Dust >2,5 μm</label>
172+
<label>Fine Dust Count 2.5μm</label>
171173
<state readOnly="true" pattern="%.0f"></state>
172174
</channel-type>
173175

174-
<channel-type id="cnt5" advanced="false">
176+
<channel-type id="cnt5" advanced="true">
175177
<item-type>Number:Dimensionless</item-type>
176-
<label>Fine Dust >5 μm</label>
178+
<label>Fine Dust Count 5μm</label>
177179
<state readOnly="true" pattern="%.0f"></state>
178180
</channel-type>
179181

180-
<channel-type id="cnt10" advanced="false">
182+
<channel-type id="cnt10" advanced="true">
181183
<item-type>Number:Dimensionless</item-type>
182-
<label>Fine Dust >10 μm</label>
184+
<label>Fine Dust Count 10μm</label>
183185
<state readOnly="true" pattern="%.0f"></state>
184186
</channel-type>
185187

186188
<channel-type id="co" advanced="false">
187-
<item-type>Number</item-type>
188-
<label>CO Concentration</label>
189-
<state readOnly="true" pattern="%.0f mg/m³"></state>
189+
<item-type unitHint="mg/m³">Number:Density</item-type>
190+
<label>Carbon Monoxide (CO)</label>
191+
<state readOnly="true" pattern="%.2f %unit%"></state>
190192
</channel-type>
191193

192194
<channel-type id="co2" advanced="false">
193-
<item-type>Number:Dimensionless</item-type>
194-
<label>CO₂ Concentration</label>
195+
<item-type unitHint="ppm">Number:Dimensionless</item-type>
196+
<label>Carbon Dioxide (CO₂)</label>
195197
<state readOnly="true" pattern="%.0f %unit%"></state>
196198
</channel-type>
197199

@@ -210,7 +212,7 @@
210212
<channel-type id="dewpt" advanced="false">
211213
<item-type>Number:Temperature</item-type>
212214
<label>Dew Point</label>
213-
<state readOnly="true" pattern="%.3f %unit%"></state>
215+
<state readOnly="true" pattern="%.2f %unit%"></state>
214216
</channel-type>
215217

216218
<channel-type id="door" advanced="false">
@@ -225,22 +227,28 @@
225227
<state readOnly="true" pattern="%.2f %unit%"></state>
226228
</channel-type>
227229

228-
<channel-type id="health" advanced="false">
229-
<item-type>Number:Dimensionless</item-type>
230+
<channel-type id="health_index" advanced="false">
231+
<item-type unitHint="%">Number:Dimensionless</item-type>
230232
<label>Health Index</label>
233+
<state readOnly="true" pattern="%.0f %unit%"></state>
234+
</channel-type>
235+
236+
<channel-type id="health" advanced="true">
237+
<item-type>Number:Dimensionless</item-type>
238+
<label>Health Index Raw</label>
231239
<state readOnly="true"></state>
232240
</channel-type>
233241

234242
<channel-type id="humidity" advanced="false">
235243
<item-type unitHint="%">Number:Dimensionless</item-type>
236244
<label>Humidity</label>
237-
<state readOnly="true" pattern="%.2f %%"></state>
245+
<state readOnly="true" pattern="%.2f %unit%"></state>
238246
</channel-type>
239247

240248
<channel-type id="humidity_abs" advanced="false">
241-
<item-type>Number</item-type>
249+
<item-type unitHint="g/m³">Number:Density</item-type>
242250
<label>Absolute Humidity</label>
243-
<state readOnly="true" pattern="%.3f g/m³"></state>
251+
<state readOnly="true" pattern="%.2f %unit%"></state>
244252
</channel-type>
245253

246254
<channel-type id="mtime" advanced="true">
@@ -250,51 +258,57 @@
250258
</channel-type>
251259

252260
<channel-type id="no2" advanced="false">
253-
<item-type>Number</item-type>
254-
<label>NO₂ Concentration</label>
255-
<state readOnly="true" pattern="%.2f μg/m³"></state>
261+
<item-type unitHint="μg/m³">Number:Density</item-type>
262+
<label>Nitrogen Dioxide (NO₂)</label>
263+
<state readOnly="true" pattern="%.2f %unit%"></state>
256264
</channel-type>
257265

258266
<channel-type id="o3" advanced="false">
259-
<item-type>Number</item-type>
260-
<label>O₃ Concentration</label>
261-
<state readOnly="true" pattern="%.2f μg/m³"></state>
267+
<item-type unitHint="µg/m³">Number:Density</item-type>
268+
<label>Ozone (O₃)</label>
269+
<state readOnly="true" pattern="%.2f %unit%"></state>
262270
</channel-type>
263271

264272
<channel-type id="oxygen" advanced="false">
265-
<item-type>Number:Dimensionless</item-type>
266-
<label>Oxygen Concentration</label>
267-
<state readOnly="true" pattern="%.3f %%"></state>
273+
<item-type unitHint="%">Number:Dimensionless</item-type>
274+
<label>Oxygen (O₂)</label>
275+
<state readOnly="true" pattern="%.2f %unit%"></state>
268276
</channel-type>
269277

270-
<channel-type id="performance" advanced="false">
271-
<item-type>Number:Dimensionless</item-type>
278+
<channel-type id="performance_index" advanced="false">
279+
<item-type unitHint="%">Number:Dimensionless</item-type>
272280
<label>Performance Index</label>
281+
<state readOnly="true" pattern="%.0f %unit%"></state>
282+
</channel-type>
283+
284+
<channel-type id="performance" advanced="true">
285+
<item-type>Number:Dimensionless</item-type>
286+
<label>Performance Index Raw</label>
273287
<state readOnly="true"></state>
274288
</channel-type>
275289

276290
<channel-type id="pm1" advanced="false">
277-
<item-type>Number</item-type>
278-
<label>Fine Dust Concentr. >1μ</label>
279-
<state readOnly="true" pattern="%.0f μg/m³"></state>
291+
<item-type unitHint="μg/m³">Number:Density</item-type>
292+
<label>Fine Dust 1μm</label>
293+
<state readOnly="true" pattern="%.0f %unit%"></state>
280294
</channel-type>
281295

282296
<channel-type id="pm10" advanced="false">
283-
<item-type>Number</item-type>
284-
<label>Fine Dust Concentr. >10μ</label>
285-
<state readOnly="true" pattern="%.0f μg/m³"></state>
297+
<item-type unitHint="μg/m³">Number:Density</item-type>
298+
<label>Fine Dust 10μm</label>
299+
<state readOnly="true" pattern="%.0f %unit%"></state>
286300
</channel-type>
287301

288302
<channel-type id="pm2_5" advanced="false">
289-
<item-type>Number</item-type>
290-
<label>Fine Dust Concentr. >2,5μ</label>
291-
<state readOnly="true" pattern="%.0f μg/m³"></state>
303+
<item-type unitHint="μg/m³">Number:Density</item-type>
304+
<label>Fine Dust 2.5μm</label>
305+
<state readOnly="true" pattern="%.0f %unit%"></state>
292306
</channel-type>
293307

294308
<channel-type id="pressure" advanced="false">
295-
<item-type>Number:Pressure</item-type>
296-
<label>Pressure</label>
297-
<state readOnly="true" pattern="%.2f hPa"></state>
309+
<item-type unitHint="hPa">Number:Pressure</item-type>
310+
<label>Barometric Pressure</label>
311+
<state readOnly="true" pattern="%.2f %unit%"></state>
298312
</channel-type>
299313

300314
<channel-type id="so2" advanced="false">
@@ -322,8 +336,8 @@
322336
</channel-type>
323337

324338
<channel-type id="tvoc" advanced="false">
325-
<item-type>Number:Dimensionless</item-type>
326-
<label>VOC Concentration</label>
339+
<item-type unitHint="ppb">Number:Dimensionless</item-type>
340+
<label>Volatile Organic Compounds (VOC)</label>
327341
<state readOnly="true" pattern="%.0f %unit%"></state>
328342
</channel-type>
329343

0 commit comments

Comments
 (0)