2 * Copyright (c) 2010-2023 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.airquality.internal.config;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.airquality.internal.AirQualityException;
19 * The {@link AirQualityConfiguration} is the class used to match the
20 * thing configuration.
22 * @author Kuba Wolanin - Initial contribution
25 public class AirQualityConfiguration {
26 public static final String LOCATION = "location";
27 public static final String STATION_ID = "stationId";
29 public String location = "";
30 public int stationId = 0;
31 public int refresh = 60;
33 public void checkValid() throws AirQualityException {
34 if (location.trim().isEmpty() && stationId == 0) {
35 throw new AirQualityException("Either 'location' or 'stationId' is mandatory and must be configured");
38 throw new AirQualityException("Parameter 'refresh' must be at least 30 minutes");