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.sleepiq.internal.api.enums;
15 import static org.openhab.binding.sleepiq.internal.SleepIQBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The {@link FoundationOutlet} represents the outlets available on the foundation.
22 * @author Mark Hilbush - Initial contribution
25 public enum FoundationOutlet {
28 RIGHT_UNDER_BED_LIGHT(3),
29 LEFT_UNDER_BED_LIGHT(4);
31 private final int outlet;
33 FoundationOutlet(final int outlet) {
41 public static FoundationOutlet forValue(int value) {
42 for (FoundationOutlet s : FoundationOutlet.values()) {
43 if (s.outlet == value) {
47 throw new IllegalArgumentException("Invalid outlet: " + value);
50 public static FoundationOutlet convertFromChannelId(String channelId) {
51 FoundationOutlet localOutlet;
53 case CHANNEL_RIGHT_NIGHT_STAND_OUTLET:
54 localOutlet = FoundationOutlet.RIGHT_NIGHT_STAND;
56 case CHANNEL_LEFT_NIGHT_STAND_OUTLET:
57 localOutlet = FoundationOutlet.LEFT_NIGHT_STAND;
59 case CHANNEL_RIGHT_UNDER_BED_LIGHT:
60 localOutlet = FoundationOutlet.RIGHT_UNDER_BED_LIGHT;
62 case CHANNEL_LEFT_UNDER_BED_LIGHT:
63 localOutlet = FoundationOutlet.LEFT_UNDER_BED_LIGHT;
66 throw new IllegalArgumentException("Can't convert channel to outlet: " + channelId);
72 public String toString() {
73 return String.valueOf(outlet);