The thing type determines the capability of a device and with that the possible ways of interacting with it.
The following matrix lists the capabilities (channels) for each type:
-| Thing Type | On/Off | Brightness | Color | Color Zone | Color Temperature | Color Temperature Zone | HEV Cycle | Infrared | Tile Effects |
-|---------------|:------:|:----------:|:-----:|:----------:|:-----------------:|:----------------------:|:---------:|:--------:|:------------:|
-| colorlight | X | | X | | X | | | | |
-| colorhevlight | X | | X | | X | | X | | |
-| colorirlight | X | | X | | X | | | X | |
-| colormzlight | X | | X | X | X | X | | | |
-| tilelight | X | X | X | | X | | | | X |
-| whitelight | X | X | | | X | | | | |
+| Thing Type | On/Off | Brightness | Color | Color Zone | (Abs) Color Temperature | (Abs) Color Temperature Zone | HEV Cycle | Infrared | Tile Effects |
+|---------------|:------:|:----------:|:-----:|:----------:|:-----------------------:|:----------------------------:|:---------:|:--------:|:------------:|
+| colorlight | X | | X | | X | | | | |
+| colorhevlight | X | | X | | X | | X | | |
+| colorirlight | X | | X | | X | | | X | |
+| colormzlight | X | | X | X | X | X | | | |
+| tilelight | X | X | X | | X | | | | X |
+| whitelight | X | X | | | X | | | | |
## Discovery
All devices support some of the following channels:
-| Channel Type ID | Item Type | Description | Thing Types |
-|-----------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
-| brightness | Dimmer | This channel supports adjusting the brightness value. | whitelight |
-| color | Color | This channel supports full color control with hue, saturation and brightness values. | colorlight, colorhevlight, colorirlight, colormzlight, tilelight |
-| colorzone | Color | This channel supports full zone color control with hue, saturation and brightness values. | colormzlight |
-| effect | String | This channel represents a type of light effect (e.g. for tile light: off, morph, flame) | tilelight |
-| hevcycle | Switch | This channel supports starting and stopping the HEV clean cycle. | colorhevlight |
-| infrared | Dimmer | This channel supports adjusting the infrared value. *Note:* IR capable lights only activate their infrared LEDs when the brightness drops below a certain level. | colorirlight |
-| signalstrength | Number | This channel represents signal strength with values 0, 1, 2, 3 or 4; 0 being worst strength and 4 being best strength. | colorlight, colorhevlight, colorirlight, colormzlight, tilelight, whitelight |
-| temperature | Dimmer | This channel supports adjusting the color temperature from cold (0%) to warm (100%). | colorlight, colorhevlight, colorirlight, colormzlight, tilelight, whitelight |
-| temperaturezone | Dimmer | This channel supports adjusting the zone color temperature from cold (0%) to warm (100%). | colormzlight |
+| Channel Type ID | Item Type | Description | Thing Types |
+|--------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
+| abstemperature | Number | This channel supports adjusting the color temperature in Kelvin. | colorlight, colorhevlight, colorirlight, colormzlight, tilelight, whitelight |
+| abstemperaturezone | Number | This channel supports adjusting the zone color temperature in Kelvin. | colormzlight |
+| brightness | Dimmer | This channel supports adjusting the brightness value. | whitelight |
+| color | Color | This channel supports full color control with hue, saturation and brightness values. | colorlight, colorhevlight, colorirlight, colormzlight, tilelight |
+| colorzone | Color | This channel supports full zone color control with hue, saturation and brightness values. | colormzlight |
+| effect | String | This channel represents a type of light effect (e.g. for tile light: off, morph, flame) | tilelight |
+| hevcycle | Switch | This channel supports starting and stopping the HEV clean cycle. | colorhevlight |
+| infrared | Dimmer | This channel supports adjusting the infrared value. *Note:* IR capable lights only activate their infrared LEDs when the brightness drops below a certain level. | colorirlight |
+| signalstrength | Number | This channel represents signal strength with values 0, 1, 2, 3 or 4; 0 being worst strength and 4 being best strength. | colorlight, colorhevlight, colorirlight, colormzlight, tilelight, whitelight |
+| temperature | Dimmer | This channel supports adjusting the color temperature from cold (0%) to warm (100%). | colorlight, colorhevlight, colorirlight, colormzlight, tilelight, whitelight |
+| temperaturezone | Dimmer | This channel supports adjusting the zone color temperature from cold (0%) to warm (100%). | colormzlight |
The *color* and *brightness* channels have a "Power On Brightness" configuration option that is used to determine the brightness when a light is switched on.
When it is left empty, the brightness of a light remains unchanged when a light is switched on or off.
The *temperature* channels have a "Power On Temperature" configuration option that is used to determine the color temperature when a light is switched on. When it is left empty, the color temperature of a light remains unchanged when a light is switched on or off.
-MultiZone lights (*colormzlight*) have several channels (e.g. *colorzone0*, *temperaturezone0*, etc.) that allow for controlling specific zones of the light.
-Changing the *color* and *temperature* channels will update the states of all zones.
-The *color* and *temperature* channels of MultiZone lights always return the same state as *colorzone0*, *temperaturezone0*.
+MultiZone lights (*colormzlight*) have several channels (e.g. *colorzone0*, *temperaturezone0*, *abstemperaturezone0*, etc.) that allow for controlling specific zones of the light.
+Changing the *color*, *temperature* and *abstemperature* channels will update the states of all zones.
+The *color*, *temperature* and *abstemperature* channels of MultiZone lights always return the same state as *colorzone0*, *temperaturezone0*, *abstemperaturezone0*.
The *hevcycle* channels have an optional "HEV Cycle Duration" configuration option that can be used to override the cycle duration configured in the light.
// Living
Color Living_Color { channel="lifx:colorlight:living:color" }
Dimmer Living_Temperature { channel="lifx:colorlight:living:temperature" }
+Number Living_Abs_Temperature { channel="lifx:colorlight:living:abstemperature" }
// Living2 (alternative approach)
Color Living2_Color { channel="lifx:colorlight:living2:color" }
Switch Living2_Switch { channel="lifx:colorlight:living2:color" }
Dimmer Living2_Dimmer { channel="lifx:colorlight:living2:color" }
Dimmer Living2_Temperature { channel="lifx:colorlight:living2:temperature" }
+Number Living2_Abs_Temperature { channel="lifx:colorlight:living2:abstemperature" }
// Desk
Color Desk_Color { channel="lifx:colorhevlight:desk:color" }
Dimmer Desk_Temperature { channel="lifx:colorhevlight:desk:temperature" }
+Number Desk_Abs_Temperature { channel="lifx:colorhevlight:desk:abstemperature" }
Switch Desk_HEV_Cycle { channel="lifx:colorhevlight:desk:hevcycle" }
// Porch
Color Porch_Color { channel="lifx:colorirlight:porch:color" }
Dimmer Porch_Infrared { channel="lifx:colorirlight:porch:infrared" }
Dimmer Porch_Temperature { channel="lifx:colorirlight:porch:temperature" }
+Number Porch_Abs_Temperature { channel="lifx:colorirlight:porch:abstemperature" }
Number Porch_Signal_Strength { channel="lifx:colorirlight:porch:signalstrength" }
// Ceiling
Color Ceiling_Color { channel="lifx:colormzlight:ceiling:color" }
Dimmer Ceiling_Temperature { channel="lifx:colormzlight:ceiling:temperature" }
+Number Ceiling_Abs_Temperature { channel="lifx:colormzlight:ceiling:abstemperature" }
Color Ceiling_Color_Zone_0 { channel="lifx:colormzlight:ceiling:colorzone0" }
Dimmer Ceiling_Temperature_Zone_0 { channel="lifx:colormzlight:ceiling:temperaturezone0" }
+Number Ceiling_Abs_Temperature_Zone_0 { channel="lifx:colormzlight:ceiling:abstemperaturezone0" }
Color Ceiling_Color_Zone_15 { channel="lifx:colormzlight:ceiling:colorzone15" }
Dimmer Ceiling_Temperature_Zone_15 { channel="lifx:colormzlight:ceiling:temperaturezone15" }
+Number Ceiling_Abs_Temperature_Zone_15 { channel="lifx:colormzlight:ceiling:abstemperaturezone15" }
// Kitchen
Switch Kitchen_Toggle { channel="lifx:whitelight:kichen:brightness" }
Dimmer Kitchen_Brightness { channel="lifx:whitelight:kitchen:brightness" }
Dimmer Kitchen_Temperature { channel="lifx:whitelight:kitchen:temperature" }
+Number Kitchen_Abs_Temperature { channel="lifx:whitelight:kitchen:abstemperature" }
```
### demo.sitemap:
Slider item=Living_Color
Colorpicker item=Living_Color
Slider item=Living_Temperature
+ Slider item=Living_Abs_Temperature
}
Frame label="Living2" {
Slider item=Living2_Dimmer
Colorpicker item=Living2_Color
Slider item=Living2_Temperature
+ Slider item=Living2_Abs_Temperature
}
Frame label="Desk" {
Slider item=Desk_Color
Colorpicker item=Desk_Color
Slider item=Desk_Temperature
+ Slider item=Desk_Abs_Temperature
Switch item=Desk_HEV_Cycle
}
Slider item=Porch_Color
Colorpicker item=Porch_Color
Slider item=Porch_Temperature
+ Slider item=Porch_Abs_Temperature
Slider item=Porch_Infrared
Text item=Porch_Signal_Strength
}
Slider item=Ceiling_Color
Colorpicker item=Ceiling_Color
Slider item=Ceiling_Temperature
+ Slider item=Ceiling_Abs_Temperature
Colorpicker item=Ceiling_Color_Zone_0
Slider item=Ceiling_Temperature_Zone_0
+ Slider item=Ceiling_Abs_Temperature_Zone_0
Colorpicker item=Ceiling_Color_Zone_15
Slider item=Ceiling_Temperature_Zone_15
+ Slider item=Ceiling_Abs_Temperature_Zone_15
}
Frame label="Kitchen" {
Switch item=Kitchen_Toggle
Slider item=Kitchen_Brightness
Slider item=Kitchen_Temperature
+ Slider item=Kitchen_Abs_Temperature
}
}
```
public static final PercentType DEFAULT_BRIGHTNESS = PercentType.HUNDRED;
// List of all Channel IDs
+ public static final String CHANNEL_ABS_TEMPERATURE = "abstemperature";
+ public static final String CHANNEL_ABS_TEMPERATURE_ZONE = "abstemperaturezone";
public static final String CHANNEL_BRIGHTNESS = "brightness";
public static final String CHANNEL_COLOR = "color";
public static final String CHANNEL_COLOR_ZONE = "colorzone";
// List of all Channel Type UIDs
public static final ChannelTypeUID CHANNEL_TYPE_BRIGHTNESS = new ChannelTypeUID(BINDING_ID, CHANNEL_BRIGHTNESS);
public static final ChannelTypeUID CHANNEL_TYPE_COLOR = new ChannelTypeUID(BINDING_ID, CHANNEL_COLOR);
- public static final ChannelTypeUID CHANNEL_TYPE_COLOR_ZONE = new ChannelTypeUID(BINDING_ID, CHANNEL_COLOR_ZONE);
public static final ChannelTypeUID CHANNEL_TYPE_EFFECT = new ChannelTypeUID(BINDING_ID, CHANNEL_EFFECT);
+ public static final ChannelTypeUID CHANNEL_TYPE_HEV_CYCLE = new ChannelTypeUID(BINDING_ID, CHANNEL_HEV_CYCLE);
public static final ChannelTypeUID CHANNEL_TYPE_INFRARED = new ChannelTypeUID(BINDING_ID, CHANNEL_INFRARED);
public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE = new ChannelTypeUID(BINDING_ID, CHANNEL_TEMPERATURE);
- public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE_ZONE = new ChannelTypeUID(BINDING_ID,
- CHANNEL_TEMPERATURE_ZONE);
// List of options for effect channel
public static final String CHANNEL_TYPE_EFFECT_OPTION_OFF = "off";
@NonNullByDefault
public interface LifxChannelFactory {
+ Channel createAbsTemperatureZoneChannel(ThingUID thingUID, int index);
+
Channel createColorZoneChannel(ThingUID thingUID, int index);
Channel createTemperatureZoneChannel(ThingUID thingUID, int index);
import static org.openhab.binding.lifx.internal.LifxBindingConstants.*;
-import java.util.Locale;
-
import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.openhab.core.i18n.LocaleProvider;
-import org.openhab.core.i18n.TranslationProvider;
+import org.openhab.core.library.CoreItemFactory;
import org.openhab.core.thing.Channel;
import org.openhab.core.thing.ChannelUID;
+import org.openhab.core.thing.DefaultSystemChannelTypeProvider;
import org.openhab.core.thing.ThingUID;
import org.openhab.core.thing.binding.builder.ChannelBuilder;
-import org.osgi.framework.Bundle;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
/**
* The {@link LifxChannelFactoryImpl} creates dynamic LIFX channels.
@Component(service = LifxChannelFactory.class)
public class LifxChannelFactoryImpl implements LifxChannelFactory {
- private static final String COLOR_ZONE_LABEL_KEY = "channel-type.lifx.colorzone.label";
- private static final String COLOR_ZONE_DESCRIPTION_KEY = "channel-type.lifx.colorzone.description";
-
- private static final String TEMPERATURE_ZONE_LABEL_KEY = "channel-type.lifx.temperaturezone.label";
- private static final String TEMPERATURE_ZONE_DESCRIPTION_KEY = "channel-type.lifx.temperaturezone.description";
-
- private @NonNullByDefault({}) Bundle bundle;
- private @NonNullByDefault({}) TranslationProvider i18nProvider;
- private @NonNullByDefault({}) LocaleProvider localeProvider;
+ @Override
+ public Channel createAbsTemperatureZoneChannel(ThingUID thingUID, int index) {
+ return ChannelBuilder
+ .create(new ChannelUID(thingUID, CHANNEL_ABS_TEMPERATURE_ZONE + index), CoreItemFactory.NUMBER)
+ .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR_TEMPERATURE_ABS).build();
+ }
@Override
public Channel createColorZoneChannel(ThingUID thingUID, int index) {
- String label = getText(COLOR_ZONE_LABEL_KEY, index);
- String description = getText(COLOR_ZONE_DESCRIPTION_KEY, index);
- return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_COLOR_ZONE + index), "Color")
- .withType(CHANNEL_TYPE_COLOR_ZONE).withLabel(label).withDescription(description).build();
+ return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_COLOR_ZONE + index), CoreItemFactory.COLOR)
+ .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR).build();
}
@Override
public Channel createTemperatureZoneChannel(ThingUID thingUID, int index) {
- String label = getText(TEMPERATURE_ZONE_LABEL_KEY, index);
- String description = getText(TEMPERATURE_ZONE_DESCRIPTION_KEY, index);
- return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_TEMPERATURE_ZONE + index), "Dimmer")
- .withType(CHANNEL_TYPE_TEMPERATURE_ZONE).withLabel(label).withDescription(description).build();
- }
-
- private @Nullable String getDefaultText(String key) {
- return i18nProvider.getText(bundle, key, key, Locale.ENGLISH);
- }
-
- private String getText(String key, Object... arguments) {
- Locale locale = localeProvider != null ? localeProvider.getLocale() : Locale.ENGLISH;
- if (i18nProvider == null) {
- return key;
- }
-
- String text = i18nProvider.getText(bundle, key, getDefaultText(key), locale, arguments);
- return text != null ? text : key;
- }
-
- @Activate
- protected void activate(ComponentContext componentContext) {
- this.bundle = componentContext.getBundleContext().getBundle();
- }
-
- @Deactivate
- protected void deactivate(ComponentContext componentContext) {
- this.bundle = null;
- }
-
- @Reference
- protected void setTranslationProvider(TranslationProvider i18nProvider) {
- this.i18nProvider = i18nProvider;
- }
-
- protected void unsetTranslationProvider(TranslationProvider i18nProvider) {
- this.i18nProvider = null;
- }
-
- @Reference
- protected void setLocaleProvider(LocaleProvider localeProvider) {
- this.localeProvider = localeProvider;
- }
-
- protected void unsetLocaleProvider(LocaleProvider localeProvider) {
- this.localeProvider = null;
+ return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_TEMPERATURE_ZONE + index), CoreItemFactory.DIMMER)
+ .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR_TEMPERATURE).build();
}
}
updateStateIfChanged(CHANNEL_BRIGHTNESS, hsb.getBrightness());
updateStateIfChanged(CHANNEL_TEMPERATURE,
kelvinToPercentType(updateColor.getKelvin(), features.getTemperatureRange()));
+ updateStateIfChanged(CHANNEL_ABS_TEMPERATURE, new DecimalType(updateColor.getKelvin()));
updateZoneChannels(powerState, colors);
}
updateStateIfChanged(CHANNEL_COLOR_ZONE + i, updateColor.getHSB());
updateStateIfChanged(CHANNEL_TEMPERATURE_ZONE + i,
kelvinToPercentType(updateColor.getKelvin(), features.getTemperatureRange()));
+ updateStateIfChanged(CHANNEL_ABS_TEMPERATURE_ZONE + i, new DecimalType(updateColor.getKelvin()));
}
}
}
// retain non-zone channels
for (Channel channel : getThing().getChannels()) {
String channelId = channel.getUID().getId();
- if (!channelId.startsWith(CHANNEL_COLOR_ZONE) && !channelId.startsWith(CHANNEL_TEMPERATURE_ZONE)) {
+ if (!channelId.startsWith(CHANNEL_ABS_TEMPERATURE_ZONE) && !channelId.startsWith(CHANNEL_COLOR_ZONE)
+ && !channelId.startsWith(CHANNEL_TEMPERATURE_ZONE)) {
newChannels.add(channel);
}
}
for (int i = 0; i < zones; i++) {
newChannels.add(channelFactory.createColorZoneChannel(getThing().getUID(), i));
newChannels.add(channelFactory.createTemperatureZoneChannel(getThing().getUID(), i));
+ newChannels.add(channelFactory.createAbsTemperatureZoneChannel(getThing().getUID(), i));
}
updateThing(editThing().withChannels(newChannels).build());
private @Nullable Runnable getChannelCommandRunnable(ChannelUID channelUID, Command command) {
switch (channelUID.getId()) {
+ case CHANNEL_ABS_TEMPERATURE:
+ case CHANNEL_TEMPERATURE:
+ if (command instanceof DecimalType) {
+ return () -> handleTemperatureCommand((DecimalType) command);
+ } else if (command instanceof IncreaseDecreaseType) {
+ return () -> handleIncreaseDecreaseTemperatureCommand((IncreaseDecreaseType) command);
+ }
case CHANNEL_BRIGHTNESS:
if (command instanceof PercentType) {
return () -> handlePercentCommand((PercentType) command);
return () -> handleOnOffCommand((OnOffType) command);
} else if (command instanceof IncreaseDecreaseType) {
return () -> handleIncreaseDecreaseCommand((IncreaseDecreaseType) command);
- } else {
- return null;
}
case CHANNEL_COLOR:
if (command instanceof HSBType) {
return () -> handleOnOffCommand((OnOffType) command);
} else if (command instanceof IncreaseDecreaseType) {
return () -> handleIncreaseDecreaseCommand((IncreaseDecreaseType) command);
- } else {
- return null;
}
case CHANNEL_EFFECT:
if (command instanceof StringType && features.hasFeature(TILE_EFFECT)) {
return () -> handleTileEffectCommand((StringType) command);
- } else {
- return null;
}
case CHANNEL_HEV_CYCLE:
if (command instanceof OnOffType) {
return () -> handleHevCycleCommand((OnOffType) command);
- } else {
- return null;
}
case CHANNEL_INFRARED:
if (command instanceof PercentType) {
return () -> handleInfraredCommand((PercentType) command);
} else if (command instanceof IncreaseDecreaseType) {
return () -> handleIncreaseDecreaseInfraredCommand((IncreaseDecreaseType) command);
- } else {
- return null;
- }
- case CHANNEL_TEMPERATURE:
- if (command instanceof PercentType) {
- return () -> handleTemperatureCommand((PercentType) command);
- } else if (command instanceof IncreaseDecreaseType) {
- return () -> handleIncreaseDecreaseTemperatureCommand((IncreaseDecreaseType) command);
- } else {
- return null;
}
default:
try {
- if (channelUID.getId().startsWith(CHANNEL_COLOR_ZONE)) {
+ if (channelUID.getId().startsWith(CHANNEL_ABS_TEMPERATURE_ZONE)) {
+ int zoneIndex = Integer.parseInt(channelUID.getId().replace(CHANNEL_ABS_TEMPERATURE_ZONE, ""));
+ if (command instanceof DecimalType) {
+ return () -> handleTemperatureCommand((DecimalType) command, zoneIndex);
+ }
+ } else if (channelUID.getId().startsWith(CHANNEL_COLOR_ZONE)) {
int zoneIndex = Integer.parseInt(channelUID.getId().replace(CHANNEL_COLOR_ZONE, ""));
if (command instanceof HSBType) {
return () -> handleHSBCommand((HSBType) command, zoneIndex);
return () -> handlePercentCommand((PercentType) command, zoneIndex);
} else if (command instanceof IncreaseDecreaseType) {
return () -> handleIncreaseDecreaseCommand((IncreaseDecreaseType) command, zoneIndex);
- } else {
- return null;
}
} else if (channelUID.getId().startsWith(CHANNEL_TEMPERATURE_ZONE)) {
int zoneIndex = Integer.parseInt(channelUID.getId().replace(CHANNEL_TEMPERATURE_ZONE, ""));
} else if (command instanceof IncreaseDecreaseType) {
return () -> handleIncreaseDecreaseTemperatureCommand((IncreaseDecreaseType) command,
zoneIndex);
- } else {
- return null;
}
- } else {
- return null;
}
} catch (NumberFormatException e) {
logger.error("Failed to parse zone index for a command of a light ({}) : {}", logId,
e.getMessage());
- return null;
}
}
+ return null;
}
private LifxLightState getLightStateForCommand() {
private void handleRefreshCommand(ChannelUID channelUID) {
channelStates.remove(channelUID.getId());
switch (channelUID.getId()) {
+ case CHANNEL_ABS_TEMPERATURE:
+ case CHANNEL_TEMPERATURE:
+ sendPacket(new GetRequest());
+ break;
case CHANNEL_COLOR:
case CHANNEL_BRIGHTNESS:
sendPacket(new GetLightPowerRequest());
case CHANNEL_SIGNAL_STRENGTH:
sendPacket(new GetWifiInfoRequest());
break;
- case CHANNEL_TEMPERATURE:
- sendPacket(new GetRequest());
- break;
default:
break;
}
}
- private void handleTemperatureCommand(PercentType temperature) {
+ private void handleTemperatureCommand(DecimalType temperature) {
HSBK newColor = getLightStateForCommand().getColor();
newColor.setSaturation(PercentType.ZERO);
- newColor.setKelvin(percentTypeToKelvin(temperature, features.getTemperatureRange()));
+ newColor.setKelvin(commandToKelvin(temperature, features.getTemperatureRange()));
getLightStateForCommand().setColor(newColor);
}
- private void handleTemperatureCommand(PercentType temperature, int zoneIndex) {
+ private void handleTemperatureCommand(DecimalType temperature, int zoneIndex) {
HSBK newColor = getLightStateForCommand().getColor(zoneIndex);
newColor.setSaturation(PercentType.ZERO);
- newColor.setKelvin(percentTypeToKelvin(temperature, features.getTemperatureRange()));
+ newColor.setKelvin(commandToKelvin(temperature, features.getTemperatureRange()));
getLightStateForCommand().setColor(newColor, zoneIndex);
}
return new PercentType(value);
}
+ public static int commandToKelvin(DecimalType temperature, TemperatureRange temperatureRange) {
+ return temperature instanceof PercentType ? percentTypeToKelvin((PercentType) temperature, temperatureRange)
+ : decimalTypeToKelvin(temperature, temperatureRange);
+ }
+
+ public static int decimalTypeToKelvin(DecimalType temperature, TemperatureRange temperatureRange) {
+ return Math.round(Math.min(Math.max(temperature.intValue(), temperatureRange.getMinimum()),
+ temperatureRange.getMaximum()));
+ }
+
public static int percentTypeToKelvin(PercentType temperature, TemperatureRange temperatureRange) {
return Math.round(
temperatureRange.getMaximum() - (temperature.floatValue() * (temperatureRange.getRange() / 100)));
# channel types
channel-type.lifx.brightness.label = Brightness
-channel-type.lifx.brightness.description = Sets the brightness of the light
+channel-type.lifx.brightness.description = Controls the brightness and switches the light on and off
channel-type.lifx.color.label = Color
-channel-type.lifx.color.description = Selects the color of the light
-channel-type.lifx.colorzone.label = Color Zone {0}
-channel-type.lifx.colorzone.description = Selects the zone {0} color of the light
+channel-type.lifx.color.description = Controls the color of the light
channel-type.lifx.effect.label = Effect
-channel-type.lifx.effect.description = Sets the effect of the light
+channel-type.lifx.effect.description = Controls the effect of the light
channel-type.lifx.effect.state.option.off = Off
channel-type.lifx.effect.state.option.morph = Morph
channel-type.lifx.effect.state.option.flame = Flame
channel-type.lifx.hevcycle.label = HEV Cycle
channel-type.lifx.hevcycle.description = Controls the HEV clean cycle of the light
channel-type.lifx.infrared.label = Infrared
-channel-type.lifx.infrared.description = Sets the infrared of the light
-channel-type.lifx.temperature.label = Temperature
-channel-type.lifx.temperature.description = Sets the temperature of the light
-channel-type.lifx.temperaturezone.label = Temperature Zone {0}
-channel-type.lifx.temperaturezone.description = Sets the zone {0} temperature of the light
+channel-type.lifx.infrared.description = Controls the infrared level of the light
+channel-type.lifx.temperature.label = Color Temperature
+channel-type.lifx.temperature.description = Controls the color temperature of the light from 0 (cold) to 100 (warm)
# channel type configuration
channel-type.config.lifx.brightness.powerOnBrightness.label = Power On Brightness
# channel types
channel-type.lifx.brightness.label = Helderheid
-channel-type.lifx.brightness.description = Bepaalt de helderheid van de lamp
+channel-type.lifx.brightness.description = Bepaalt de helderheid en schakelt het licht aan en uit
channel-type.lifx.color.label = Kleur
-channel-type.lifx.color.description = Bepaalt de kleur van de lamp
-channel-type.lifx.colorzone.label = Kleur Zone {0}
-channel-type.lifx.colorzone.description = Bepaalt de kleur van lampzone {0}
+channel-type.lifx.color.description = Bepaalt de kleur van het licht
channel-type.lifx.effect.label = Effect
channel-type.lifx.effect.description = Bepaalt het lichteffect
channel-type.lifx.effect.state.option.off = Uit
channel-type.lifx.effect.state.option.morph = Morph
channel-type.lifx.effect.state.option.flame = Vlam
channel-type.lifx.hevcycle.label = HEV Cyclus
-channel-type.lifx.hevcycle.description = Bedient de HEV schoonmaakcylcus van de lamp
+channel-type.lifx.hevcycle.description = Bedient de HEV schoonmaakcyclus van de lamp
channel-type.lifx.infrared.label = Infrarood
channel-type.lifx.infrared.description = Bepaalt het infraroodniveau van de lamp
-channel-type.lifx.temperature.label = Temperatuur
-channel-type.lifx.temperature.description = Bepaalt de kleurtemperatuur van de lamp
-channel-type.lifx.temperaturezone.label = Temperatuur Zone {0}
-channel-type.lifx.temperaturezone.description = Bepaalt de kleurtemperatuur van lampzone {0}
+channel-type.lifx.temperature.label = Kleurtemperatuur
+channel-type.lifx.temperature.description = Bepaalt de kleurtemperatuur van het licht van 0 (koud) tot 100 (warm)
# channel type configuration
channel-type.config.lifx.brightness.powerOnBrightness.label = Inschakelhelderheid
<channel-type id="brightness">
<item-type>Dimmer</item-type>
<label>Brightness</label>
- <description>Sets the brightness of the light</description>
+ <description>Controls the brightness and switches the light on and off</description>
<category>DimmableLight</category>
<tags>
- <tag>Lighting</tag>
+ <tag>Control</tag>
+ <tag>Light</tag>
</tags>
<config-description-ref uri="channel-type:lifx:brightness"/>
</channel-type>
<channel-type id="color">
<item-type>Color</item-type>
<label>Color</label>
- <description>Selects the color of the light</description>
+ <description>Controls the color of the light</description>
<category>ColorLight</category>
<tags>
- <tag>Lighting</tag>
+ <tag>Control</tag>
+ <tag>Light</tag>
</tags>
<config-description-ref uri="channel-type:lifx:color"/>
</channel-type>
- <channel-type id="colorzone" advanced="true">
- <item-type>Color</item-type>
- <label>Color Zone</label>
- <description>Selects the zone color of the light</description>
- <category>ColorLight</category>
- <tags>
- <tag>Lighting</tag>
- </tags>
- </channel-type>
-
<channel-type id="hevcycle">
<item-type>Switch</item-type>
<label>HEV Cycle</label>
<description>Controls the HEV clean cycle of the light</description>
+ <tags>
+ <tag>Control</tag>
+ <tag>Light</tag>
+ </tags>
<config-description-ref uri="channel-type:lifx:hevcycle"/>
</channel-type>
<channel-type id="infrared">
<item-type>Dimmer</item-type>
<label>Infrared</label>
- <description>Sets the infrared of the light</description>
+ <description>Controls the infrared level of the light</description>
+ <tags>
+ <tag>Control</tag>
+ <tag>Light</tag>
+ </tags>
</channel-type>
<channel-type id="temperature">
<item-type>Dimmer</item-type>
- <label>Temperature</label>
- <description>Sets the temperature of the light</description>
+ <label>Color Temperature</label>
+ <description>Controls the color temperature of the light from 0 (cold) to 100 (warm)</description>
<category>ColorLight</category>
+ <tags>
+ <tag>Control</tag>
+ <tag>ColorTemperature</tag>
+ </tags>
<config-description-ref uri="channel-type:lifx:temperature"/>
</channel-type>
- <channel-type id="temperaturezone" advanced="true">
- <item-type>Dimmer</item-type>
- <label>Temperature Zone</label>
- <description>Sets the zone temperature of the light</description>
- <category>ColorLight</category>
- </channel-type>
-
<channel-type id="effect">
<item-type>String</item-type>
<label>Effect</label>
- <description>Sets the effect of the light</description>
+ <description>Controls the effect of the light</description>
+ <tags>
+ <tag>Control</tag>
+ <tag>Light</tag>
+ </tags>
<state>
<options>
<option value="off">Off</option>
<channels>
<channel id="color" typeId="color"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="hevcycle" typeId="hevcycle"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
</channels>
<channels>
<channel id="color" typeId="color"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="infrared" typeId="infrared"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
</channels>
<channels>
<channel id="color" typeId="color"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
</channels>
<representation-property>macAddress</representation-property>
<channels>
<channel id="color" typeId="color"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
</channels>
<representation-property>macAddress</representation-property>
<channels>
<channel id="color" typeId="color"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
<channel id="effect" typeId="effect"/>
</channels>
<channels>
<channel id="brightness" typeId="brightness"/>
<channel id="temperature" typeId="temperature"/>
+ <channel id="abstemperature" typeId="system.color-temperature-abs"/>
<channel id="signalstrength" typeId="system.signal-strength"/>
</channels>
<representation-property>macAddress</representation-property>