Skip to content

Commit

Permalink
[airq] Add health/performance channels in percent, add UoM, refine un…
Browse files Browse the repository at this point in the history
…it hints and state patterns, make item labels consistent

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
  • Loading branch information
fwolter committed May 1, 2024
1 parent e812d2d commit d9daa50
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 76 deletions.
16 changes: 9 additions & 7 deletions bundles/org.openhab.binding.airq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,28 @@ The rw column is empty if the channel is only readable, w if the channel can be
| fineDustCnt02_5 | Number:Dimensionless | | Fine Dust >2,5 µm |
| fineDustCnt05 | Number:Dimensionless | | Fine Dust >5 µm |
| fineDustCnt10 | Number:Dimensionless | | Fine Dust >10 µm |
| co | Number | | CO concentration |
| co2 | Number:Dimensionless | | CO₂ concentration |
| co | Number:Density | | Carbon monoxide (CO) concentration |
| co2 | Number:Dimensionless | | Carbon dioxide (CO₂) concentration |
| dCO2dt | Number | | Change of CO₂ concentration |
| dHdt | Number | | Change of Humidity |
| dewpt | Number:Temperature | | Dew Point |
| doorEvent | Number | | Door Event (experimental, might not work reliably) |
| h2s | Number:Density | | Hydrogen sulfide (H₂S) |
| healthIndex | Number:Dimensionless | | Health Index in percent |
| health | Number:Dimensionless | | Health Index (0 to 1000, -200 for gas alarm, -800 for fire alarm) |
| humidityRelative | Number:Dimensionless | | Humidity in percent |
| humidityAbsolute | Number | | Absolute Humidity |
| humidityAbsolute | Number:Density | | Absolute Humidity |
| measureTime | Number:Time | | Milliseconds needed for measurement |
| no2 | Number | | NO₂ concentration |
| o3 | Number | | Ozone (O₃) concentration |
| no2 | Number:Density | | Nitrogen Dioxide (NO₂) concentration |
| o3 | Number:Density | | Ozone (O₃) concentration |
| o2 | Number:Dimensionless | | Oxygen (O₂) concentration |
| performanceIndex | Number:Dimensionless | | Performance Index in percent |
| performance | Number:Dimensionless | | Performance Index (0 to 1000) |
| fineDustConc01 | Number | | Fine Dust concentration >1 µm |
| fineDustConc02_5 | Number | | Fine Dust concentration >2.5 µm |
| fineDustConc10 | Number | | Fine Dust concentration >10 µm |
| pressure | Number:Pressure | | Pressure |
| so2 | Number | | SO₂ concentration |
| pressure | Number:Pressure | | Barometric Pressure |
| so2 | Number | | Sulfur dioxide (SO₂) concentration |
| sound | Number:Dimensionless | | Noise |
| temperature | Number:Temperature | | Temperature |
| timestamp | DateTime | | Timestamp of measurement |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,10 @@ public void pollData() {
processType(decObj, "dCO2dt", "dCO2dt", "number");
processType(decObj, "dHdt", "dHdt", "number");
processType(decObj, "door_event", "doorEvent", "number");
processType(decObj, "health", "healthIndex", "index");
processType(decObj, "health", "health", "number");
processType(decObj, "measuretime", "measureTime", "number");
processType(decObj, "performance", "performanceIndex", "index");
processType(decObj, "performance", "performance", "number");
processType(decObj, "timestamp", "timestamp", "datetime");
processType(decObj, "uptime", "uptime", "numberTimePeriod");
Expand Down Expand Up @@ -626,6 +628,10 @@ private void processType(JsonObject dec, String airqName, String channelName, St
updateState(channelName, new QuantityType<>(pairDB.getValue(), Units.DECIBEL));
updateState(channelName + "_maxerr", new DecimalType(pairDB.getMaxdev()));
break;
case "index":
double rawValue = Double.parseDouble(dec.get(airqName).toString());
updateState(channelName, new QuantityType<>(rawValue / 10, Units.PERCENT));
break;
case "datetime":
Long timest = Long.valueOf(dec.get(airqName).toString());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ channel-type.airq.WarmupPhase.label = Send data as in Warmup Phase
channel-type.airq.Wifi.label = Use WLAN
channel-type.airq.WifiInfo.label = Show WLAN Status with LED
channel-type.airq.cloudUpload.label = Upload to air-Q Cloud
channel-type.airq.cnt0_3.label = Fine Dust >0,3 μm
channel-type.airq.cnt0_3.label = Fine Dust Count 0.3μm
channel-type.airq.cnt0_3_maxerr.label = Max. Error Fine Dust >0,3μm
channel-type.airq.cnt0_5.label = Fine Dust >0,5 μm
channel-type.airq.cnt0_5.label = Fine Dust Count 0.5 μm
channel-type.airq.cnt0_5_maxerr.label = Max. Error Fine Dust >0,5μm
channel-type.airq.cnt1.label = Fine Dust >1 μm
channel-type.airq.cnt10.label = Fine Dust >10 μm
channel-type.airq.cnt1.label = Fine Dust Count 1μm
channel-type.airq.cnt10.label = Fine Dust Count 10μm
channel-type.airq.cnt10_maxerr.label = Max. Error Fine Dust >10μm
channel-type.airq.cnt1_maxerr.label = Max. Error Fine Dust >1μm
channel-type.airq.cnt2_5.label = Fine Dust >2,5 μm
channel-type.airq.cnt2_5.label = Fine Dust Count 2.5μm
channel-type.airq.cnt2_5_maxerr.label = Max. Error Fine Dust >2,5μm
channel-type.airq.cnt5.label = Fine Dust >5 μm
channel-type.airq.cnt5.label = Fine Dust Count 5μm
channel-type.airq.cnt5_maxerr.label = Max. Error Fine Dust >5μm
channel-type.airq.co.label = CO Concentration
channel-type.airq.co2.label = CO₂ Concentration
channel-type.airq.co.label = Carbon Monoxide (CO)
channel-type.airq.co2.label = Carbon Dioxide (CO₂)
channel-type.airq.co2_maxerr.label = Max. Error CO₂ Conc.
channel-type.airq.co_maxerr.label = Max. Error CO Conc.
channel-type.airq.dco2dt.label = Change of CO₂ Concentr.
Expand All @@ -69,7 +69,8 @@ channel-type.airq.door.label = Door Event (exp)
channel-type.airq.geopos.label = Location of air-Q Device
channel-type.airq.h2s.label = Hydrogen Sulfide (H₂S)
channel-type.airq.h2s_maxerr.label = Max. Error H₂S Conc.
channel-type.airq.health.label = Health Index
channel-type.airq.health.label = Health Index Raw
channel-type.airq.health_index.label = Health Index
channel-type.airq.humidity.label = Humidity
channel-type.airq.humidity_abs.label = Absolute Humidity
channel-type.airq.humidity_abs_maxerr.label = Max. Error Abs. Humidity
Expand All @@ -81,22 +82,23 @@ channel-type.airq.nightmodeFanNightOff.label = Switch Off Fan at Night
channel-type.airq.nightmodeStartDay.label = Start of Day Operation
channel-type.airq.nightmodeStartNight.label = End of Day Operation
channel-type.airq.nightmodeWifiNightOff.label = Switch Off WLAN at Night
channel-type.airq.no2.label = NO₂ Concentration
channel-type.airq.no2.label = Nitrogen Dioxide (NO₂)
channel-type.airq.no2_maxerr.label = Max. Error NO₂ Conc.
channel-type.airq.o3.label = O₃ Concentration
channel-type.airq.o3.label = Ozone (O₃)
channel-type.airq.o3_maxerr.label = Max. Error O₃ Conc.
channel-type.airq.oxygen.label = Oxygen Concentration
channel-type.airq.oxygen.label = Oxygen (O₂)
channel-type.airq.oxygen_maxerr.label = Max. Error Oxygen Conc.
channel-type.airq.pass.label = Device Password
channel-type.airq.performance.label = Performance Index
channel-type.airq.pm1.label = Fine Dust Concentr. >1μ
channel-type.airq.pm10.label = Fine Dust Concentr. >10μ
channel-type.airq.performance.label = Performance Index Raw
channel-type.airq.performance_index.label = Performance Index
channel-type.airq.pm1.label = Fine Dust 1μm
channel-type.airq.pm10.label = Fine Dust 10μm
channel-type.airq.pm10_maxerr.label = Max. Error Fine Dust Conc. >10μm
channel-type.airq.pm1_maxerr.label = Max. Error Fine Dust Conc. >1μm
channel-type.airq.pm2_5.label = Fine Dust Concentr. >2,5μ
channel-type.airq.pm2_5.label = Fine Dust 2.5μm
channel-type.airq.pm2_5_maxerr.label = Max. Error Fine Dust Conc. >2,5μm
channel-type.airq.ppm_and_ppb.label = Values in Particles
channel-type.airq.pressure.label = Pressure
channel-type.airq.pressure.label = Barometric Pressure
channel-type.airq.pressure_maxerr.label = Max. Error Pressure
channel-type.airq.so2.label = SO₂ Concentration
channel-type.airq.so2_maxerr.label = Max. Error SO₂ Conc.
Expand All @@ -106,7 +108,7 @@ channel-type.airq.status.label = Status of Sensors
channel-type.airq.temperature.label = Temperature
channel-type.airq.temperature_maxerr.label = Max. Error Temperature
channel-type.airq.timestamp.label = Time Stamp
channel-type.airq.tvoc.label = VOC Concentration
channel-type.airq.tvoc.label = Volatile Organic Compounds (VOC)
channel-type.airq.tvoc_maxerr.label = Max. Error VOC Conc.
channel-type.airq.typps.label = Average Size of Fine Dust
channel-type.airq.uptime.label = Uptime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
<channel id="dewpt" typeId="dewpt"/>
<channel id="doorEvent" typeId="door"/>
<channel id="h2s" typeId="h2s"/>
<channel id="healthIndex" typeId="health_index"/>
<channel id="health" typeId="health"/>
<channel id="humidityRelative" typeId="humidity"/>
<channel id="humidityAbsolute" typeId="humidity_abs"/>
<channel id="measureTime" typeId="mtime"/>
<channel id="no2" typeId="no2"/>
<channel id="o3" typeId="o3"/>
<channel id="o2" typeId="oxygen"/>
<channel id="performanceIndex" typeId="performance_index"/>
<channel id="performance" typeId="performance"/>
<channel id="fineDustConc01" typeId="pm1"/>
<channel id="fineDustConc02_5" typeId="pm2_5"/>
Expand Down Expand Up @@ -117,7 +119,7 @@
<property name="sensorList">Unknown sensor list</property>
<property name="sensorInfo">No info about sensors</property>
<property name="industry">No industry info</property>
<property name="thingTypeVersion">1</property>
<property name="thingTypeVersion">2</property>
</properties>

<config-description>
Expand All @@ -142,56 +144,56 @@
</channel-type>

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

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

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

<channel-type id="cnt1" advanced="false">
<channel-type id="cnt1" advanced="true">
<item-type>Number:Dimensionless</item-type>
<label>Fine Dust >1 μm</label>
<label>Fine Dust Count 1μm</label>
<state readOnly="true" pattern="%.0f"></state>
</channel-type>

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

<channel-type id="cnt5" advanced="false">
<channel-type id="cnt5" advanced="true">
<item-type>Number:Dimensionless</item-type>
<label>Fine Dust >5 μm</label>
<label>Fine Dust Count 5μm</label>
<state readOnly="true" pattern="%.0f"></state>
</channel-type>

<channel-type id="cnt10" advanced="false">
<channel-type id="cnt10" advanced="true">
<item-type>Number:Dimensionless</item-type>
<label>Fine Dust >10 μm</label>
<label>Fine Dust Count 10μm</label>
<state readOnly="true" pattern="%.0f"></state>
</channel-type>

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

<channel-type id="co2" advanced="false">
<item-type>Number:Dimensionless</item-type>
<label>CO₂ Concentration</label>
<item-type unitHint="ppm">Number:Dimensionless</item-type>
<label>Carbon Dioxide (CO₂)</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

Expand All @@ -210,7 +212,7 @@
<channel-type id="dewpt" advanced="false">
<item-type>Number:Temperature</item-type>
<label>Dew Point</label>
<state readOnly="true" pattern="%.3f %unit%"></state>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

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

<channel-type id="health" advanced="false">
<item-type>Number:Dimensionless</item-type>
<channel-type id="health_index" advanced="false">
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Health Index</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

<channel-type id="health" advanced="true">
<item-type>Number:Dimensionless</item-type>
<label>Health Index Raw</label>
<state readOnly="true"></state>
</channel-type>

<channel-type id="humidity" advanced="false">
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Humidity</label>
<state readOnly="true" pattern="%.2f %%"></state>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="humidity_abs" advanced="false">
<item-type>Number</item-type>
<item-type unitHint="g/m³">Number:Density</item-type>
<label>Absolute Humidity</label>
<state readOnly="true" pattern="%.3f g/m³"></state>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="mtime" advanced="true">
Expand All @@ -250,51 +258,57 @@
</channel-type>

<channel-type id="no2" advanced="false">
<item-type>Number</item-type>
<label>NO₂ Concentration</label>
<state readOnly="true" pattern="%.2f μg/m³"></state>
<item-type unitHint="μg/m³">Number:Density</item-type>
<label>Nitrogen Dioxide (NO₂)</label>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="o3" advanced="false">
<item-type>Number</item-type>
<label>O₃ Concentration</label>
<state readOnly="true" pattern="%.2f μg/m³"></state>
<item-type unitHint="µg/m³">Number:Density</item-type>
<label>Ozone (O₃)</label>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="oxygen" advanced="false">
<item-type>Number:Dimensionless</item-type>
<label>Oxygen Concentration</label>
<state readOnly="true" pattern="%.3f %%"></state>
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Oxygen (O₂)</label>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="performance" advanced="false">
<item-type>Number:Dimensionless</item-type>
<channel-type id="performance_index" advanced="false">
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Performance Index</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

<channel-type id="performance" advanced="true">
<item-type>Number:Dimensionless</item-type>
<label>Performance Index Raw</label>
<state readOnly="true"></state>
</channel-type>

<channel-type id="pm1" advanced="false">
<item-type>Number</item-type>
<label>Fine Dust Concentr. >1μ</label>
<state readOnly="true" pattern="%.0f μg/m³"></state>
<item-type unitHint="μg/m³">Number:Density</item-type>
<label>Fine Dust 1μm</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

<channel-type id="pm10" advanced="false">
<item-type>Number</item-type>
<label>Fine Dust Concentr. >10μ</label>
<state readOnly="true" pattern="%.0f μg/m³"></state>
<item-type unitHint="μg/m³">Number:Density</item-type>
<label>Fine Dust 10μm</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

<channel-type id="pm2_5" advanced="false">
<item-type>Number</item-type>
<label>Fine Dust Concentr. >2,5μ</label>
<state readOnly="true" pattern="%.0f μg/m³"></state>
<item-type unitHint="μg/m³">Number:Density</item-type>
<label>Fine Dust 2.5μm</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

<channel-type id="pressure" advanced="false">
<item-type>Number:Pressure</item-type>
<label>Pressure</label>
<state readOnly="true" pattern="%.2f hPa"></state>
<item-type unitHint="hPa">Number:Pressure</item-type>
<label>Barometric Pressure</label>
<state readOnly="true" pattern="%.2f %unit%"></state>
</channel-type>

<channel-type id="so2" advanced="false">
Expand Down Expand Up @@ -322,8 +336,8 @@
</channel-type>

<channel-type id="tvoc" advanced="false">
<item-type>Number:Dimensionless</item-type>
<label>VOC Concentration</label>
<item-type unitHint="ppb">Number:Dimensionless</item-type>
<label>Volatile Organic Compounds (VOC)</label>
<state readOnly="true" pattern="%.0f %unit%"></state>
</channel-type>

Expand Down

0 comments on commit d9daa50

Please sign in to comment.