console.println("Bad thing id '" + args[0] + "'");
printUsage(console);
} else if (thingHandler == null) {
- console.println("No handler initialized for the thing id '" + args[0] + "'");
+ console.println("No handler initialized for the thingUID '" + args[0] + "'");
printUsage(console);
} else if (bridgeHandler == null && groupHandler == null) {
- console.println("'" + args[0] + "' is neither a hue bridge id nor a hue group thing id");
+ console.println("'" + args[0] + "' is neither a Hue bridgeUID nor a Hue groupThingUID");
printUsage(console);
} else {
switch (args[1]) {
String userName = bridgeHandler.getUserName();
console.println("Your user name is " + (userName != null ? userName : "undefined"));
} else {
- console.println("'" + args[0] + "' is not a hue bridge id");
+ console.println("'" + args[0] + "' is not a Hue bridgeUID");
printUsage(console);
}
break;
import java.math.BigDecimal;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
@NonNullByDefault
public class HueGroupHandler extends BaseThingHandler implements GroupStatusListener {
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_GROUP);
+ public static final String PROPERTY_MEMBERS = "members";
private final Logger logger = LoggerFactory.getLogger(HueGroupHandler.class);
private final HueStateDescriptionOptionProvider stateDescriptionOptionProvider;
}
}
+ private synchronized void initializeProperties(@Nullable FullGroup fullGroup) {
+ if (fullGroup != null) {
+ Map<String, String> properties = editProperties();
+ properties.put(PROPERTY_MEMBERS, fullGroup.getLightIds().stream().collect(Collectors.joining(",")));
+ updateProperties(properties);
+ }
+ }
+
@Override
public void dispose() {
logger.debug("Hue group handler disposes. Unregistering listener.");
logger.trace("New state for group {}", groupId);
+ initializeProperties(group);
+
lastSentColorTemp = null;
lastSentBrightness = null;
THING_TYPE_COLOR_TEMPERATURE_LIGHT, THING_TYPE_DIMMABLE_LIGHT, THING_TYPE_EXTENDED_COLOR_LIGHT,
THING_TYPE_ON_OFF_LIGHT, THING_TYPE_ON_OFF_PLUG, THING_TYPE_DIMMABLE_PLUG);
- private static final Map<String, List<String>> VENDOR_MODEL_MAP = Map.of( //
- "Philips", List.of("LCT001", "LCT002", "LCT003", "LCT007", "LLC001", "LLC006", "LLC007", "LLC010", //
- "LLC011", "LLC012", "LLC013", "LLC020", "LST001", "LST002", "LWB004", "LWB006", "LWB007", //
- "LWL001"),
- "OSRAM", List.of("Classic_A60_RGBW", "PAR16_50_TW", "Surface_Light_TW", "Plug_01"));
-
- private static final String OSRAM_PAR16_50_TW_MODEL_ID = "PAR16_50_TW";
+ public static final String OSRAM_PAR16_50_TW_MODEL_ID = "PAR16_50_TW";
private final Logger logger = LoggerFactory.getLogger(HueLightHandler.class);
+
private final HueStateDescriptionOptionProvider stateDescriptionOptionProvider;
private @NonNullByDefault({}) String lightId;
String modelId = fullLight.getNormalizedModelID();
if (modelId != null) {
properties.put(PROPERTY_MODEL_ID, modelId);
- String vendor = getVendor(modelId);
- if (vendor != null) {
- properties.put(PROPERTY_VENDOR, vendor);
- }
- } else {
- properties.put(PROPERTY_VENDOR, fullLight.getManufacturerName());
}
+ properties.put(PROPERTY_VENDOR, fullLight.getManufacturerName());
properties.put(PRODUCT_NAME, fullLight.getProductName());
String uniqueID = fullLight.getUniqueID();
if (uniqueID != null) {
}
}
- private @Nullable String getVendor(String modelId) {
- for (String vendor : VENDOR_MODEL_MAP.keySet()) {
- if (VENDOR_MODEL_MAP.get(vendor).contains(modelId)) {
- return vendor;
- }
- }
- return null;
- }
-
@Override
public void dispose() {
logger.debug("Hue light handler disposes. Unregistering listener.");
channel-type.hue.alert.state.option.LSELECT = Mehrfaches Blinken
channel-type.hue.effect.label = Farbeffekt
channel-type.hue.effect.description = Ermöglicht einen automatischen Farbwechsels.
+channel-type.hue.scene.label = Szene
+channel-type.hue.scene.description = Ermöglicht das Anwenden einer Szene für alle Lichter, die zur Gruppe gehören.
channel-type.hue.last_updated.label = Letzte Aktualisierung
channel-type.hue.last_updated.description = Zeit, zu der sich dieser Wert geändert hat.
import static org.mockito.Mockito.*;
import static org.openhab.binding.hue.internal.HueBindingConstants.*;
-import java.util.Collections;
+import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
private static final int MAX_COLOR_TEMPERATURE = 500;
private static final int COLOR_TEMPERATURE_RANGE = MAX_COLOR_TEMPERATURE - MIN_COLOR_TEMPERATURE;
- private static final String OSRAM_MODEL_TYPE = "PAR16 50 TW";
- private static final String OSRAM_MODEL_TYPE_ID = "PAR16_50_TW";
+ private static final String OSRAM = "OSRAM";
+ private static final String OSRAM_MODEL_TYPE = HueLightHandler.OSRAM_PAR16_50_TW_MODEL_ID;
+ private static final String OSRAM_MODEL_TYPE_ID = HueLightHandler.OSRAM_PAR16_50_TW_MODEL_ID;
private Gson gson;
@Test
public void assertCommandForOsramPar1650ForColorTemperatureChannelOn() {
String expectedReply = "{\"on\" : true, \"bri\" : 254}";
- assertSendCommandForColorTempForPar16(OnOffType.ON, new HueLightState(OSRAM_MODEL_TYPE), expectedReply);
+ assertSendCommandForColorTempForPar16(OnOffType.ON, new HueLightState(OSRAM_MODEL_TYPE, OSRAM), expectedReply);
}
@Test
public void assertCommandForOsramPar1650ForColorTemperatureChannelOff() {
String expectedReply = "{\"on\" : false, \"transitiontime\" : 0}";
- assertSendCommandForColorTempForPar16(OnOffType.OFF, new HueLightState(OSRAM_MODEL_TYPE), expectedReply);
+ assertSendCommandForColorTempForPar16(OnOffType.OFF, new HueLightState(OSRAM_MODEL_TYPE, OSRAM), expectedReply);
}
@Test
public void assertCommandForOsramPar1650ForBrightnessChannelOn() {
String expectedReply = "{\"on\" : true, \"bri\" : 254}";
- assertSendCommandForBrightnessForPar16(OnOffType.ON, new HueLightState(OSRAM_MODEL_TYPE), expectedReply);
+ assertSendCommandForBrightnessForPar16(OnOffType.ON, new HueLightState(OSRAM_MODEL_TYPE, OSRAM), expectedReply);
}
@Test
public void assertCommandForOsramPar1650ForBrightnessChannelOff() {
String expectedReply = "{\"on\" : false, \"transitiontime\" : 0}";
- assertSendCommandForBrightnessForPar16(OnOffType.OFF, new HueLightState(OSRAM_MODEL_TYPE), expectedReply);
+ assertSendCommandForBrightnessForPar16(OnOffType.OFF, new HueLightState(OSRAM_MODEL_TYPE, OSRAM),
+ expectedReply);
}
@Test
private void assertSendCommandForColorTempForPar16(Command command, HueLightState currentState,
String expectedReply) {
- assertSendCommand(CHANNEL_COLORTEMPERATURE, command, currentState, expectedReply, OSRAM_MODEL_TYPE_ID, "OSRAM");
+ assertSendCommand(CHANNEL_COLORTEMPERATURE, command, currentState, expectedReply, OSRAM_MODEL_TYPE_ID, OSRAM);
}
private void assertSendCommandForBrightnessForPar16(Command command, HueLightState currentState,
String expectedReply) {
- assertSendCommand(CHANNEL_BRIGHTNESS, command, currentState, expectedReply, OSRAM_MODEL_TYPE_ID, "OSRAM");
+ assertSendCommand(CHANNEL_BRIGHTNESS, command, currentState, expectedReply, OSRAM_MODEL_TYPE_ID, OSRAM);
}
private void assertSendCommandForColor(Command command, HueLightState currentState, String expectedReply) {
when(mockBridge.getStatus()).thenReturn(ThingStatus.ONLINE);
Thing mockThing = mock(Thing.class);
- when(mockThing.getConfiguration()).thenReturn(new Configuration(Collections.singletonMap(LIGHT_ID, "1")));
+ when(mockThing.getConfiguration()).thenReturn(new Configuration(Map.of(LIGHT_ID, "1")));
HueClient mockClient = mock(HueClient.class);
when(mockClient.getLightById(any())).thenReturn(light);
String effect = "none";
String colorMode = "hs";
String model = "LCT001";
+ String vendor = "Philips";
public HueLightState() {
}
- public HueLightState(String model) {
+ public HueLightState(String model, String vendor) {
this.model = model;
+ this.vendor = vendor;
}
public HueLightState bri(int brightness) {
" \"type\": \"Extended color light\"," + //
" \"name\": \"Hue Light 1\"," + //
" \"modelid\": \"" + model + "\"," + //
+ " \"manufacturername\": \"" + vendor + "\"," + //
" \"swversion\": \"65003148\"," + //
" \"uniqueid\": \"00:17:88:01:00:e1:88:29-0b\"," + //
" \"pointsymbol\": {" + //