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.pjlinkdevice.internal.device.command.power;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.pjlinkdevice.internal.device.command.PrefixedResponse;
17 import org.openhab.binding.pjlinkdevice.internal.device.command.ResponseException;
20 * The response part of {@link PowerQueryCommand}
22 * @author Nils Schnabel - Initial contribution
25 public class PowerQueryResponse extends PrefixedResponse<PowerQueryResponse.PowerQueryResponseValue> {
26 public enum PowerQueryResponseValue {
27 STAND_BY("Stand-by", "0"),
28 POWER_ON("Power on", "1"),
29 COOLING_DOWN("Cooling down", "2"),
30 WARMING_UP("Warming up", "3");
35 private PowerQueryResponseValue(String text, String code) {
40 public String getText() {
44 public static PowerQueryResponseValue parseString(String code) throws ResponseException {
45 for (PowerQueryResponseValue result : PowerQueryResponseValue.values()) {
46 if (result.code.equals(code)) {
51 throw new ResponseException("Cannot understand power status: " + code);
55 public PowerQueryResponse(String response) throws ResponseException {
56 super("POWR=", response);
60 protected PowerQueryResponseValue parseResponseWithoutPrefix(String responseWithoutPrefix)
61 throws ResponseException {
62 return PowerQueryResponseValue.parseString(responseWithoutPrefix);