]> git.basschouten.com Git - openhab-addons.git/blob
bfa7173a0e27fa525aec951fd9fd696a84e64df7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.bluetooth.airthings.internal;
14
15 import java.math.BigInteger;
16
17 import javax.measure.Unit;
18 import javax.measure.quantity.Dimensionless;
19
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.SmartHomeUnits;
24 import org.openhab.core.thing.ThingTypeUID;
25
26 import tec.uom.se.format.SimpleUnitFormat;
27 import tec.uom.se.function.RationalConverter;
28 import tec.uom.se.unit.ProductUnit;
29 import tec.uom.se.unit.TransformedUnit;
30 import tec.uom.se.unit.Units;
31
32 /**
33  * The {@link AirthingsBindingConstants} class defines common constants, which are
34  * used across the whole binding.
35  *
36  * @author Pauli Anttila - Initial contribution
37  */
38 @NonNullByDefault
39 public class AirthingsBindingConstants {
40
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");
44
45     // Channel IDs
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";
53
54     public static final Unit<Dimensionless> PARTS_PER_BILLION = new TransformedUnit<>(SmartHomeUnits.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(Units.CUBIC_METRE));
58
59     static {
60         SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
61         SimpleUnitFormat.getInstance().label(BECQUEREL_PER_CUBIC_METRE, "Bq/m³");
62     }
63 }