]> git.basschouten.com Git - openhab-addons.git/blob
11cc84cc94a49c0d6e05fdf3e7c05632839fde93
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.solarmax.internal.connector;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link SolarMaxCommandKey} enum defines the commands that are understood by the SolarMax device
19  *
20  * @author Jamie Townsend - Initial contribution
21  */
22 @NonNullByDefault
23 public enum SolarMaxCommandKey {
24     // for further commands, that are not implemented here, see this binding's README.md file
25
26     // Valid commands which returned a non-null value during testing
27     buildNumber("BDN"), //
28     startups("CAC"), //
29     acPhase1Current("IL1"), //
30     acPhase2Current("IL2"), //
31     acPhase3Current("IL3"), //
32     energyGeneratedToday("KDY"), //
33     operatingHours("KHR"), //
34     energyGeneratedYesterday("KLD"), //
35     energyGeneratedLastMonth("KLM"), //
36     energyGeneratedLastYear("KLY"), //
37     energyGeneratedThisMonth("KMT"), //
38     energyGeneratedTotal("KT0"), //
39     energyGeneratedThisYear("KYR"), //
40     currentPowerGenerated("PAC"), //
41     softwareVersion("SWV"), //
42     heatSinkTemperature("TKK"), //
43     acFrequency("TNF"), //
44     acPhase1Voltage("UL1"), //
45     acPhase2Voltage("UL2"), //
46     acPhase3Voltage("UL3"), //
47     UNKNOWN("UNKNOWN") // really unknown - shouldn't ever be sent to the device
48     ;
49
50     private String commandKey;
51
52     private SolarMaxCommandKey(String commandKey) {
53         this.commandKey = commandKey;
54     }
55
56     public String getCommandKey() {
57         return this.commandKey;
58     }
59
60     public static SolarMaxCommandKey getKeyFromString(String commandKey) {
61         for (SolarMaxCommandKey key : SolarMaxCommandKey.values()) {
62             if (key.commandKey.equals(commandKey)) {
63                 return key;
64             }
65         }
66         return UNKNOWN;
67     }
68 }