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;
18 import javax.measure.Unit;
19 import javax.measure.quantity.Dimensionless;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.openhab.binding.bluetooth.BluetoothBindingConstants;
23 import org.openhab.core.library.dimension.Density;
24 import org.openhab.core.library.unit.SIUnits;
25 import org.openhab.core.library.unit.Units;
26 import org.openhab.core.thing.ThingTypeUID;
28 import tec.uom.se.format.SimpleUnitFormat;
29 import tec.uom.se.function.RationalConverter;
30 import tec.uom.se.unit.ProductUnit;
31 import tec.uom.se.unit.TransformedUnit;
34 * The {@link AirthingsBindingConstants} class defines common constants, which are
35 * used across the whole binding.
37 * @author Pauli Anttila - Initial contribution
38 * @author Kai Kreuzer - Added Airthings Wave Mini support
41 public class AirthingsBindingConstants {
43 // List of all Thing Type UIDs
44 public static final ThingTypeUID THING_TYPE_AIRTHINGS_WAVE_PLUS = new ThingTypeUID(
45 BluetoothBindingConstants.BINDING_ID, "airthings_wave_plus");
46 public static final ThingTypeUID THING_TYPE_AIRTHINGS_WAVE_MINI = new ThingTypeUID(
47 BluetoothBindingConstants.BINDING_ID, "airthings_wave_mini");
49 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_AIRTHINGS_WAVE_PLUS,
50 THING_TYPE_AIRTHINGS_WAVE_MINI);
53 public static final String CHANNEL_ID_HUMIDITY = "humidity";
54 public static final String CHANNEL_ID_TEMPERATURE = "temperature";
55 public static final String CHANNEL_ID_PRESSURE = "pressure";
56 public static final String CHANNEL_ID_CO2 = "co2";
57 public static final String CHANNEL_ID_TVOC = "tvoc";
58 public static final String CHANNEL_ID_RADON_ST_AVG = "radon_st_avg";
59 public static final String CHANNEL_ID_RADON_LT_AVG = "radon_lt_avg";
61 public static final Unit<Dimensionless> PARTS_PER_BILLION = new TransformedUnit<>(Units.ONE,
62 new RationalConverter(BigInteger.ONE, BigInteger.valueOf(1000000000)));
63 public static final Unit<Density> BECQUEREL_PER_CUBIC_METRE = new ProductUnit<>(
64 Units.BECQUEREL.divide(SIUnits.CUBIC_METRE));
67 SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
68 SimpleUnitFormat.getInstance().label(BECQUEREL_PER_CUBIC_METRE, "Bq/m³");