2 * Copyright (c) 2010-2024 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.airgradient.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * Data model class for a single measurement from AirGradients API.
21 * @author Jørgen Austvik - Initial contribution
24 public class Measure {
27 * Returns a location id that is guaranteed to not be null.
29 * @return A non null location id.
31 public String getLocationId() {
32 String loc = locationId;
41 * Returns a location name that is guaranteed to not be null.
43 * @return A non null location name.
45 public String getLocationName() {
46 String name = locationName;
47 return (name != null) ? name : "";
51 * Returns a serial number that is guaranteed to not be null.
53 * @return A non null serial number.
55 public String getSerialNo() {
56 String serial = serialno;
65 * Returns a firmware version that is guaranteed to not be null.
67 * @return A non null firmware version.
69 public String getFirmwareVersion() {
70 String fw = firmwareVersion;
78 public @Nullable String getModel() {
79 // model from cloud API
85 // model from local API
95 public String locationId;
98 public String locationName;
101 public String serialno;
104 public Double pm01; // The raw PM 1 value in ug
107 public Double pm02; // The raw PM 2.5 value in ug
110 public Double pm10; // The raw PM 10 value in ug
113 public Double pm003Count; // The number of particles with a diameter beyond 0.3 microns in 1 deciliter of air
116 public Double atmp; // The ambient temperature in celsius
119 public Double rhum; // The relative humidity in percent
122 public Double rco2; // The CO2 value in ppm
125 public Double tvoc; // The TVOC value in ppb, provided in case that the sensor delivers an absolute value
128 public Double tvocIndex; // The value of the TVOC index, sensor model dependent
131 public Double noxIndex; // The value of the NOx index, sensor model dependent
134 public Double wifi; // The wifi signal strength in dBm
137 public Integer datapoints; // The number of datapoints, present only for aggregated data
140 public String timestamp; // Timestamp of the measures in ISO 8601 format with UTC offset, e.g. 2022-03-28T12:07:40Z
143 public String firmwareVersion; // The firmware version running on the device, e.g. "9.2.6", not present for averages
146 public String ledMode; // co2, pm, off, default
149 public String ledCo2Threshold1;
152 public String ledCo2Threshold2;
155 public String ledCo2ThresholdEnd;
158 public Long boot; // Number of times sensor has uploaded data since last reboot
161 public String fwMode; // Model of sensor from local API
164 public String model; // Model of sensor from cloud API