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