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.easee.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * this enum represents the charger operation states as documented by https://developer.easee.cloud/docs/enumerations
22 * @author Alexander Friese - initial contribution
25 public enum ChargerOpState {
37 private static final Logger LOGGER = LoggerFactory.getLogger(ChargerOpState.class);
38 private final int code;
40 private ChargerOpState(int code) {
44 public boolean isAuthenticatedState() {
56 public static ChargerOpState fromCode(String code) {
58 return ChargerOpState.fromCode(Integer.parseInt(code));
59 } catch (NumberFormatException ex) {
60 LOGGER.warn("caught exception while parsing ChargerOpState code: '{}' - exception: {}", code,
66 public static ChargerOpState fromCode(int code) {
67 for (ChargerOpState state : ChargerOpState.values()) {
68 if (state.code == code) {
72 LOGGER.info("unknown ChargerOpState code: '{}'", code);