[airthings] Adapt channels to new dimention for Radon measurements (#15011)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
f34aa8fa5c
commit
1b7dbd7ef9
|
@ -38,18 +38,18 @@ Following channels are supported for `Airthings Wave Mini` thing:
|
||||||
The `Airthings Wave Plus` thing has additionally the following channels:
|
The `Airthings Wave Plus` thing has additionally the following channels:
|
||||||
|
|
||||||
| Channel ID | Item Type | Description |
|
| Channel ID | Item Type | Description |
|
||||||
| ------------------ | ------------------------ | ------------------------------------------- |
|
| ------------------ | -------------------------------- | ------------------------------------------- |
|
||||||
| pressure | Number:Pressure | The measured air pressure |
|
| pressure | Number:Pressure | The measured air pressure |
|
||||||
| co2 | Number:Dimensionless | The measured CO2 level |
|
| co2 | Number:Dimensionless | The measured CO2 level |
|
||||||
| radon_st_avg | Number:Density | The measured radon short term average level |
|
| radon_st_avg | Number:RadiationSpecificActivity | The measured radon short term average level |
|
||||||
| radon_lt_avg | Number:Density | The measured radon long term average level |
|
| radon_lt_avg | Number:RadiationSpecificActivity | The measured radon long term average level |
|
||||||
|
|
||||||
The `Airthings Wave Gen 1` thing has the following channels:
|
The `Airthings Wave Gen 1` thing has the following channels:
|
||||||
|
|
||||||
| Channel ID | Item Type | Description |
|
| Channel ID | Item Type | Description |
|
||||||
| ------------------ | ------------------------ | ------------------------------------------- |
|
| ------------------ | -------------------------------- | ------------------------------------------- |
|
||||||
| radon_st_avg | Number:Density | The measured radon short term average level |
|
| radon_st_avg | Number:RadiationSpecificActivity | The measured radon short term average level |
|
||||||
| radon_lt_avg | Number:Density | The measured radon long term average level |
|
| radon_lt_avg | Number:RadiationSpecificActivity | The measured radon long term average level |
|
||||||
| temperature | Number:Temperature | The measured temperature |
|
| temperature | Number:Temperature | The measured temperature |
|
||||||
| humidity | Number:Dimensionless | The measured humidity |
|
| humidity | Number:Dimensionless | The measured humidity |
|
||||||
|
|
||||||
|
@ -71,6 +71,6 @@ Number:Dimensionless humidity "Humidity [%d %unit%]"
|
||||||
Number:Pressure pressure "Air Pressure [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:pressure" }
|
Number:Pressure pressure "Air Pressure [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:pressure" }
|
||||||
Number:Dimensionless co2 "CO2 level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:co2" }
|
Number:Dimensionless co2 "CO2 level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:co2" }
|
||||||
Number:Dimensionless tvoc "TVOC level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:tvoc" }
|
Number:Dimensionless tvoc "TVOC level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:tvoc" }
|
||||||
Number:Density radon_st_avg "Radon short term average level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:radon_st_avg" }
|
Number:RadiationSpecificActivity radon_st_avg "Radon short term average level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:radon_st_avg" }
|
||||||
Number:Density radon_lt_avg "Radon long term average level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:radon_lt_avg" }
|
Number:RadiationSpecificActivity radon_lt_avg "Radon long term average level [%d %unit%]" { channel="bluetooth:airthings_wave_plus:adapter1:sensor1:radon_lt_avg" }
|
||||||
```
|
```
|
||||||
|
|
|
@ -22,7 +22,7 @@ import javax.measure.quantity.Pressure;
|
||||||
import javax.measure.quantity.Temperature;
|
import javax.measure.quantity.Temperature;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.core.library.dimension.Density;
|
import org.openhab.core.library.dimension.RadiationSpecificActivity;
|
||||||
import org.openhab.core.library.types.QuantityType;
|
import org.openhab.core.library.types.QuantityType;
|
||||||
import org.openhab.core.library.unit.SIUnits;
|
import org.openhab.core.library.unit.SIUnits;
|
||||||
import org.openhab.core.library.unit.Units;
|
import org.openhab.core.library.unit.Units;
|
||||||
|
@ -77,13 +77,13 @@ public class AirthingsWavePlusHandler extends AbstractAirthingsHandler {
|
||||||
}
|
}
|
||||||
Number radonShortTermAvg = data.get(AirthingsDataParser.RADON_SHORT_TERM_AVG);
|
Number radonShortTermAvg = data.get(AirthingsDataParser.RADON_SHORT_TERM_AVG);
|
||||||
if (radonShortTermAvg != null) {
|
if (radonShortTermAvg != null) {
|
||||||
updateState(CHANNEL_ID_RADON_ST_AVG,
|
updateState(CHANNEL_ID_RADON_ST_AVG, new QuantityType<RadiationSpecificActivity>(radonShortTermAvg,
|
||||||
new QuantityType<Density>(radonShortTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
Units.BECQUEREL_PER_CUBIC_METRE));
|
||||||
}
|
}
|
||||||
Number radonLongTermAvg = data.get(AirthingsDataParser.RADON_LONG_TERM_AVG);
|
Number radonLongTermAvg = data.get(AirthingsDataParser.RADON_LONG_TERM_AVG);
|
||||||
if (radonLongTermAvg != null) {
|
if (radonLongTermAvg != null) {
|
||||||
updateState(CHANNEL_ID_RADON_LT_AVG,
|
updateState(CHANNEL_ID_RADON_LT_AVG,
|
||||||
new QuantityType<Density>(radonLongTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
new QuantityType<RadiationSpecificActivity>(radonLongTermAvg, Units.BECQUEREL_PER_CUBIC_METRE));
|
||||||
}
|
}
|
||||||
} catch (AirthingsParserException e) {
|
} catch (AirthingsParserException e) {
|
||||||
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());
|
logger.error("Failed to parse data received from Airthings sensor: {}", e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue