]> git.basschouten.com Git - openhab-addons.git/blob
f10923dc5877a0c6ba97264cf96e8f3e0b0021d8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.pentair.internal.handler.helpers;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * The {@link PentairControllerLightMode } enum constants used to define the different light modes of the controller.
21  *
22  * @author Jeff James - Initial contribution
23  */
24 @NonNullByDefault
25 public enum PentairControllerLightMode {
26     EMPTY(-1, ""),
27     OFF(0, "Off"),
28     ON(1, "On"),
29     COLORSYNC(128, "Color Sync"),
30     COLORSWIM(144, "Color Swim"),
31     COLORSET(160, "COLORSET"),
32     PARTY(177, "PARTY"),
33     ROMANCE(178, "ROMANCE"),
34     CARIBBENA(179, "CARIBBEAN"),
35     AMERICAN(180, "AMERICAN"),
36     SUNSET(181, "SUNSET"),
37     ROYAL(182, "ROYAL"),
38     BLUE(193, "BLUE"),
39     GREEN(194, "GREEN"),
40     RED(195, "RED"),
41     WHITE(96, "WHITE"),
42     MAGENTA(197, "MAGENTA");
43
44     private final int number;
45     private final String name;
46
47     private PentairControllerLightMode(int n, String name) {
48         this.number = n;
49         this.name = name;
50     }
51
52     public int getModeNumber() {
53         return number;
54     }
55
56     public String getName() {
57         return name;
58     }
59
60     public static PentairControllerLightMode valueOfModeNumber(int modeNumber) {
61         return Arrays.stream(values()).filter(value -> (value.getModeNumber() == modeNumber)).findFirst().orElse(EMPTY);
62     }
63 }