Skip to content

Commit

Permalink
[amazonechocontrol] Improve color temperature channel (openhab#17754)
Browse files Browse the repository at this point in the history
Signed-off-by: AndrewFG <software@whitebear.ch>
  • Loading branch information
andrewfg authored and matchews committed Dec 16, 2024
1 parent 9dac7f8 commit 457d87a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
3 changes: 2 additions & 1 deletion bundles/org.openhab.binding.amazonechocontrol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ The channels of the smarthome devices will be generated at runtime. Check in the
|--------------------------|----------------------|-------------|-------------------------------|------------------------------------------------------------------------------------------
| powerState | Switch | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the state (ON/OFF) of your device
| brightness | Dimmer | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the brightness of your lamp
| color | Color | R | smartHomeDevice, smartHomeDeviceGroup | Shows the color of your light
| color | Color | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows the color of your light
| colorName | String | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the color name of your light (groups are not able to show their color)
| colorTemperatureInKelvin | Number:Temperature | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows the color temperature of your light
| colorTemperatureName | String | R/W | smartHomeDevice, smartHomeDeviceGroup | White temperatures name of your lights (groups are not able to show their color)
| armState | String | R/W | smartHomeDevice, smartHomeDeviceGroup | State of your alarm guard. Options: ARMED_AWAY, ARMED_STAY, ARMED_NIGHT, DISARMED (groups are not able to show their state)
| burglaryAlarm | Contact | R | smartHomeDevice | Burglary alarm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
package org.openhab.binding.amazonechocontrol.internal.smarthome;

import static org.openhab.binding.amazonechocontrol.internal.smarthome.Constants.ITEM_TYPE_NUMBER;
import static org.openhab.binding.amazonechocontrol.internal.smarthome.Constants.ITEM_TYPE_STRING;
import static org.openhab.binding.amazonechocontrol.internal.smarthome.Constants.*;

import java.io.IOException;
import java.util.List;
Expand All @@ -28,6 +27,7 @@
import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeDevices.SmartHomeDevice;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.StringType;
import org.openhab.core.thing.DefaultSystemChannelTypeProvider;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.types.Command;
import org.openhab.core.types.StateDescription;
Expand All @@ -51,13 +51,13 @@ public class HandlerColorTemperatureController extends HandlerBase {
private static final ChannelTypeUID CHANNEL_TYPE_COLOR_TEMPERATURE_NAME = new ChannelTypeUID(
AmazonEchoControlBindingConstants.BINDING_ID, "colorTemperatureName");

private static final ChannelTypeUID CHANNEL_TYPE_COLOR_TEPERATURE_IN_KELVIN = new ChannelTypeUID(
AmazonEchoControlBindingConstants.BINDING_ID, "colorTemperatureInKelvin");
private static final ChannelTypeUID CHANNEL_TYPE_COLOR_TEMPERATURE_IN_KELVIN = //
DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR_TEMPERATURE_ABS;

// Channel and Properties
private static final ChannelInfo COLOR_TEMPERATURE_IN_KELVIN = new ChannelInfo(
"colorTemperatureInKelvin" /* propertyName */ , "colorTemperatureInKelvin" /* ChannelId */,
CHANNEL_TYPE_COLOR_TEPERATURE_IN_KELVIN /* Channel Type */ , ITEM_TYPE_NUMBER /* Item Type */);
CHANNEL_TYPE_COLOR_TEMPERATURE_IN_KELVIN /* Channel Type */ , ITEM_TYPE_NUMBER_TEMPERATURE /* Item Type */);

private static final ChannelInfo COLOR_TEMPERATURE_NAME = new ChannelInfo("colorProperties" /* propertyName */ ,
"colorTemperatureName" /* ChannelId */, CHANNEL_TYPE_COLOR_TEMPERATURE_NAME /* Channel Type */ ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ channel-type.amazonechocontrol.color.label = Color
channel-type.amazonechocontrol.color.description = Color
channel-type.amazonechocontrol.colorName.label = Color Name
channel-type.amazonechocontrol.colorName.description = Color Name
channel-type.amazonechocontrol.colorTemperatureInKelvin.label = Color Temperature In Kelvin
channel-type.amazonechocontrol.colorTemperatureInKelvin.description = Color Temperature In Kelvin
channel-type.amazonechocontrol.colorTemperatureName.label = Color Temperature Name
channel-type.amazonechocontrol.colorTemperatureName.description = Color Temperature Name
channel-type.amazonechocontrol.equalizerBass.label = Bass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@
</supported-bridge-type-refs>
<label>Smart Home Device</label>
<description>Smart home device connected to Alexa</description>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>id</representation-property>
<config-description>
<parameter name="id" type="text" required="true">
Expand All @@ -269,6 +272,9 @@
</supported-bridge-type-refs>
<label>Smart Home Device Group</label>
<description>Group of smart home devices in your amazon account</description>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>id</representation-property>
<config-description>
<parameter name="id" type="text" required="true">
Expand Down Expand Up @@ -573,11 +579,6 @@
<label>Color Temperature Name</label>
<description>Color Temperature Name</description>
</channel-type>
<channel-type id="colorTemperatureInKelvin">
<item-type>Number</item-type>
<label>Color Temperature In Kelvin</label>
<description>Color Temperature In Kelvin</description>
</channel-type>
<!-- Alexa.PercentageController -->
<channel-type id="percentage">
<item-type>Dimmer</item-type>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">

<thing-type uid="amazonechocontrol:smartHomeDevice">
<instruction-set targetVersion="1">
<update-channel id="colorTemperatureInKelvin">
<type>system:color-temperature-abs</type>
</update-channel>
</instruction-set>
</thing-type>

<thing-type uid="amazonechocontrol:smartHomeDeviceGroup">
<instruction-set targetVersion="1">
<update-channel id="colorTemperatureInKelvin">
<type>system:color-temperature-abs</type>
</update-channel>
</instruction-set>
</thing-type>

</update:update-descriptions>

0 comments on commit 457d87a

Please sign in to comment.