2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bluetooth.airthings.internal;
15 import java.math.BigInteger;
17 import javax.measure.Unit;
18 import javax.measure.quantity.Dimensionless;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.binding.bluetooth.BluetoothBindingConstants;
22 import org.openhab.core.library.dimension.Density;
23 import org.openhab.core.library.unit.SIUnits;
24 import org.openhab.core.library.unit.Units;
25 import org.openhab.core.thing.ThingTypeUID;
27 import tec.uom.se.format.SimpleUnitFormat;
28 import tec.uom.se.function.RationalConverter;
29 import tec.uom.se.unit.ProductUnit;
30 import tec.uom.se.unit.TransformedUnit;
33 * The {@link AirthingsBindingConstants} class defines common constants, which are
34 * used across the whole binding.
36 * @author Pauli Anttila - Initial contribution
39 public class AirthingsBindingConstants {
41 // List of all Thing Type UIDs
42 public static final ThingTypeUID THING_TYPE_AIRTHINGS_WAVE_PLUS = new ThingTypeUID(
43 BluetoothBindingConstants.BINDING_ID, "airthings_wave_plus");
46 public static final String CHANNEL_ID_HUMIDITY = "humidity";
47 public static final String CHANNEL_ID_TEMPERATURE = "temperature";
48 public static final String CHANNEL_ID_PRESSURE = "pressure";
49 public static final String CHANNEL_ID_CO2 = "co2";
50 public static final String CHANNEL_ID_TVOC = "tvoc";
51 public static final String CHANNEL_ID_RADON_ST_AVG = "radon_st_avg";
52 public static final String CHANNEL_ID_RADON_LT_AVG = "radon_lt_avg";
54 public static final Unit<Dimensionless> PARTS_PER_BILLION = new TransformedUnit<>(Units.ONE,
55 new RationalConverter(BigInteger.ONE, BigInteger.valueOf(1000000000)));
56 public static final Unit<Density> BECQUEREL_PER_CUBIC_METRE = new ProductUnit<>(
57 Units.BECQUEREL.divide(SIUnits.CUBIC_METRE));
60 SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
61 SimpleUnitFormat.getInstance().label(BECQUEREL_PER_CUBIC_METRE, "Bq/m³");