2 * Copyright (c) 2010-2022 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
14 package org.openhab.binding.nanoleaf.internal.layout;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.openhab.binding.nanoleaf.internal.colors.NanoleafPanelColors;
18 import org.openhab.core.library.types.HSBType;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * Stores the state of the panels.
25 * @author Jørgen Austvik - Initial contribution
28 public class LivePanelState implements PanelState {
30 private static final Logger logger = LoggerFactory.getLogger(LivePanelState.class);
31 private final NanoleafPanelColors panelColors;
33 public LivePanelState(NanoleafPanelColors panelColors) {
34 this.panelColors = panelColors;
38 public HSBType getHSBForPanel(Integer panelId) {
39 if (logger.isTraceEnabled()) {
40 if (!panelColors.hasColor(panelId)) {
41 logger.trace("Failed to get color for panel {}, falling back to black", panelId);
45 return panelColors.getColor(panelId, HSBType.BLACK);