2 * Copyright (c) 2010-2021 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.venstarthermostat.internal.dto;
16 * The {@link VenstarSystemState} represents the value of the system state
17 * returneda from the REST API.
19 * @author William Welliver - Initial contribution
21 public enum VenstarSystemState {
22 IDLE(0, "idle", "Idle"),
23 HEATING(1, "heating", "Heating"),
24 COOLING(2, "cooling", "Cooling"),
25 LOCKOUT(3, "lockout", "Lockout"),
26 ERROR(4, "error", "Error");
30 private String friendlyName;
32 VenstarSystemState(int state, String name, String friendlyName) {
35 this.friendlyName = friendlyName;
42 public String stateName() {
46 public String friendlyName() {
50 public static VenstarSystemState fromInt(int state) {
51 for (VenstarSystemState ss : values()) {
52 if (ss.state == state) {
57 throw (new IllegalArgumentException("Invalid system state " + state));