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.openuv.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.DecimalType;
17 import org.openhab.core.types.State;
18 import org.openhab.core.types.UnDefType;
21 * The {@link AlertLevel} enum defines alert level in regard of the UV Index
23 * @author Gaƫl L'hopital - Initial contribution
26 public enum AlertLevel {
27 GREEN(DecimalType.ZERO, "3a8b2f"),
28 YELLOW(new DecimalType(1), "f9a825"),
29 ORANGE(new DecimalType(2), "ef6c00"),
30 RED(new DecimalType(3), "b71c1c"),
31 PURPLE(new DecimalType(4), "6a1b9a"),
32 UNKNOWN(UnDefType.NULL, "b3b3b3");
34 public final State state;
35 public final String color;
37 AlertLevel(State state, String color) {
42 public static AlertLevel fromUVIndex(double uv) {