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.milight.internal.handler;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.milight.internal.MilightThingState;
17 import org.openhab.binding.milight.internal.protocol.ProtocolConstants;
18 import org.openhab.binding.milight.internal.protocol.QueuedSend;
19 import org.openhab.core.thing.Thing;
22 * Implements the iBox led bulb. The bulb is integrated into the iBox and does not include a white channel, so no
23 * saturation or colour temperature available.
25 * @author David Graeff - Initial contribution
28 public class MilightV6RGBIBOXHandler extends AbstractLedV6Handler {
29 private static final byte ADDR = 0x00;
31 public MilightV6RGBIBOXHandler(Thing thing, QueuedSend sendQueue) {
32 super(thing, sendQueue, 0);
36 protected byte getAddr() {
41 public void setPower(boolean on, MilightThingState state) {
42 sendNonRepeatable(3, on ? 3 : 4);
46 public void whiteMode(MilightThingState state) {
47 sendRepeatableCat(ProtocolConstants.CAT_WHITEMODE, 3, 5);
51 public void nightMode(MilightThingState state) {
52 logger.info("Night mode not supported by iBox led!");
56 public void setColorTemperature(int colorTemp, MilightThingState state) {
57 logger.info("Color temperature not supported by iBox led!");
61 public void changeColorTemperature(int colorTempRelative, MilightThingState state) {
62 logger.info("Color temperature not supported by iBox led!");
66 protected byte getBrCmd() {
71 public void setSaturation(int value, MilightThingState state) {
72 logger.info("Saturation not supported by iBox led!");
76 public void setLedMode(int newmode, MilightThingState state) {
77 int mode = Math.max(Math.min(newmode, 9), 1);
78 sendRepeatableCat(ProtocolConstants.CAT_MODE_SET, 4, Math.max(Math.min(newmode, 9), 1));
79 state.animationMode = mode;
83 public void changeSpeed(int relativeSpeed, MilightThingState state) {
84 sendNonRepeatable(3, relativeSpeed > 1 ? 2 : 1);