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.epsonprojector.internal.enums;
15 import java.util.Arrays;
16 import java.util.NoSuchElementException;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * Messages for documented error codes.
23 * @author Pauli Anttila - Initial contribution
24 * @author Yannick Schaus - Refactoring
25 * @author Michael Lobstein - Improvements for OH3
28 public enum ErrorMessage {
29 NO_ERROR(0, "No error"),
30 ERROR1(1, "Fan error"),
31 ERROR3(3, "Lamp failure at power on"),
32 ERROR4(4, "High internal temperature error"),
33 ERROR6(6, "Lamp error"),
34 ERROR7(7, "Open Lamp cover door error"),
35 ERROR8(8, "Cinema filter error"),
36 ERROR9(9, "Electric dual-layered capacitor is disconnected"),
37 ERROR10(10, "Auto iris error"),
38 ERROR11(11, "Subsystem error"),
39 ERROR12(12, "Low air flow error"),
40 ERROR13(13, "Air filter air flow sensor error"),
41 ERROR14(14, "Power supply unit error (ballast)"),
42 ERROR15(15, "Shutter error"),
43 ERROR16(16, "Cooling system error (peltier element)"),
44 ERROR17(17, "Cooling system error (pump)"),
45 ERROR18(18, "Static iris error"),
46 ERROR19(19, "Power supply unit error (disagreement of ballast)"),
47 ERROR20(20, "Exhaust shutter error"),
48 ERROR21(21, "Obstacle detection error"),
49 ERROR22(22, "IF board discernment error");
51 private final int code;
52 private final String message;
54 ErrorMessage(int code, String message) {
56 this.message = message;
59 public String getMessage() {
63 public static String forCode(int code) {
65 return Arrays.stream(values()).filter(e -> e.code == code).findFirst().get().getMessage();
66 } catch (NoSuchElementException e) {
67 return "Unknown error code: " + code;