Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lifx] Add channels for controlling absolute color temperature in Kelvin #11309

Merged
merged 2 commits into from Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 40 additions & 22 deletions bundles/org.openhab.binding.lifx/README.md
Expand Up @@ -43,14 +43,14 @@ The following table lists the thing types of the supported LIFX devices:
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

Expand Down Expand Up @@ -85,17 +85,19 @@ Thing lifx:colorirlight:porch [ host="10.120.130.4", fadetime=0 ]

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.
Expand All @@ -107,9 +109,9 @@ If both "Power on brightness" and "Power On Color" configuration options are def

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.

Expand Down Expand Up @@ -174,36 +176,44 @@ Thing lifx:whitelight:kitchen [ deviceId="D073D5D4D4D4", fadetime=150 ]
// 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:
Expand All @@ -216,20 +226,23 @@ sitemap demo label="Main Menu"
Slider item=Living_Color
Colorpicker item=Living_Color
Slider item=Living_Temperature
Slider item=Living_Abs_Temperature
}

Frame label="Living2" {
Switch item=Living2_Toggle
Slider item=Living2_Dimmer
Colorpicker item=Living2_Color
Slider item=Living2_Temperature
Slider item=Living2_Abs_Temperature
}

Frame label="Desk" {
Switch item=Desk_Color
Slider item=Desk_Color
Colorpicker item=Desk_Color
Slider item=Desk_Temperature
Slider item=Desk_Abs_Temperature
Switch item=Desk_HEV_Cycle
}

Expand All @@ -238,6 +251,7 @@ sitemap demo label="Main Menu"
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
}
Expand All @@ -247,16 +261,20 @@ sitemap demo label="Main Menu"
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
}
}
```
Expand Up @@ -49,6 +49,8 @@ public class LifxBindingConstants {
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";
Expand All @@ -62,12 +64,10 @@ public class LifxBindingConstants {
// 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";
Expand Down
Expand Up @@ -24,6 +24,8 @@
@NonNullByDefault
public interface LifxChannelFactory {

Channel createAbsTemperatureZoneChannel(ThingUID thingUID, int index);

Channel createColorZoneChannel(ThingUID thingUID, int index);

Channel createTemperatureZoneChannel(ThingUID thingUID, int index);
Expand Down