diff --git a/bundles/org.openhab.binding.avmfritz/README.md b/bundles/org.openhab.binding.avmfritz/README.md
index 13191f37a..af5670fa7 100644
--- a/bundles/org.openhab.binding.avmfritz/README.md
+++ b/bundles/org.openhab.binding.avmfritz/README.md
@@ -168,39 +168,41 @@ The AIN (actor identification number) can be found in the FRITZ!Box interface ->
## Supported Channels
-| Channel Type ID | Item Type | Description | Available on thing |
-|-----------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
-| incoming_call | Call | Details about incoming call. %2$s contains the external, calling number, %1$s is the internal, receiving number. | FRITZ!Box |
-| outgoing_call | Call | Details about outgoing call. %1$s contains the external, called number, %2$s is the internal, calling number. | FRITZ!Box |
-| active_call | Call | Details about active call. %1$s contains the external, calling number, %2$s is empty. | FRITZ!Box |
-| call_state | String | Details about current call state, either IDLE, RINGING, DIALING or ACTIVE. | FRITZ!Box |
-| apply_template | String | Apply template for device(s) (channel's state options contains available templates, for an alternative way see the description below) - FRITZ!OS 7 | FRITZ!Box, FRITZ!Powerline 546E |
-| mode | String | States the mode of the device (MANUAL/AUTOMATIC/VACATION) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
-| locked | Contact | Device is locked for switching over external sources (OPEN/CLOSE) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
-| device_locked | Contact | Device is locked for switching manually (OPEN/CLOSE) - FRITZ!OS 6.90 | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
-| temperature | Number:Temperature | Current measured temperature | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!DECT Repeater 100, FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 440 |
-| humidity | Number:Dimensionless | Current measured humidity - FRITZ!OS 7.24 | FRITZ!DECT 440 |
-| energy | Number:Energy | Accumulated energy consumption | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
-| power | Number:Power | Current power consumption | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
-| voltage | Number:ElectricPotential | Current voltage - FRITZ!OS 7 | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
-| outlet | Switch | Switchable outlet (ON/OFF) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
-| on_off | Switch | Switchable device (ON/OFF) | HAN_FUN_ON_OFF |
-| brightness | Dimmer | Dimmable lights | HAN_FUN_DIMMABLE_BULB |
-| color | Color | Color lights | FRITZ!DECT 500, HAN_FUN_COLOR_BULB |
-| actual_temp | Number:Temperature | Current temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
-| set_temp | Number:Temperature | Set Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
-| eco_temp | Number:Temperature | Eco Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
-| comfort_temp | Number:Temperature | Comfort Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
-| radiator_mode | String | Mode of heating thermostat (ON/OFF/COMFORT/ECO/BOOST/WINDOW_OPEN) | FRITZ!DECT 30x, Comet DECT |
-| next_change | DateTime | Next change of the Set Temperature if scheduler is activated in the FRITZ!Box settings - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT |
-| next_temp | Number:Temperature | Next Set Temperature if scheduler is activated in the FRITZ!Box settings - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT |
-| battery_level | Number | Battery level (in %) - FRITZ!OS 7 | FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 400, FRITZ!DECT 440 |
-| battery_low | Switch | Battery level low (ON/OFF) - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 400, FRITZ!DECT 440 |
-| contact_state | Contact | Contact state information (OPEN/CLOSED). | HAN-FUN contact (e.g. SmartHome Tür-/Fensterkontakt or SmartHome Bewegungsmelder)- FRITZ!OS 7 |
-| last_change | DateTime | States the last time the button was pressed. | FRITZ!DECT 400, FRITZ!DECT 440, HAN-FUN switch (e.g. SmartHome Wandtaster) - FRITZ!OS 7 |
-| rollershutter | Rollershutter | Rollershutter control and status. Accepts UP/DOWN/STOP commands and the opening level in percent. States the opening level in percent. | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
-| obstruction_alarm | Obstruction Alarm | Rollershutter obstruction alarm (ON/OFF) | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
-| temperature_alarm | Temperature Alarm | Rollershutter temperature alarm (ON/OFF) | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
+| Channel Type ID | Item Type | Description | Available on thing |
+|-----------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
+| incoming_call | Call | Details about incoming call. %2$s contains the external, calling number, %1$s is the internal, receiving number. | FRITZ!Box |
+| outgoing_call | Call | Details about outgoing call. %1$s contains the external, called number, %2$s is the internal, calling number. | FRITZ!Box |
+| active_call | Call | Details about active call. %1$s contains the external, calling number, %2$s is empty. | FRITZ!Box |
+| call_state | String | Details about current call state, either IDLE, RINGING, DIALING or ACTIVE. | FRITZ!Box |
+| apply_template | String | Apply template for device(s) (channel's state options contains available templates, for an alternative way see the description below) - FRITZ!OS 7 | FRITZ!Box, FRITZ!Powerline 546E |
+| mode | String | States the mode of the device (MANUAL/AUTOMATIC/VACATION) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
+| locked | Contact | Device is locked for switching over external sources (OPEN/CLOSE) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
+| device_locked | Contact | Device is locked for switching manually (OPEN/CLOSE) - FRITZ!OS 6.90 | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E, FRITZ!DECT 30x, Comet DECT |
+| temperature | Number:Temperature | Current measured temperature | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!DECT Repeater 100, FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 440 |
+| humidity | Number:Dimensionless | Current measured humidity - FRITZ!OS 7.24 | FRITZ!DECT 440 |
+| energy | Number:Energy | Accumulated energy consumption | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
+| power | Number:Power | Current power consumption | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
+| voltage | Number:ElectricPotential | Current voltage - FRITZ!OS 7 | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
+| outlet | Switch | Switchable outlet (ON/OFF) | FRITZ!DECT 210, FRITZ!DECT 200, FRITZ!Powerline 546E |
+| on_off | Switch | Switchable device (ON/OFF) | HAN_FUN_ON_OFF |
+| brightness | Dimmer | Dimmable lights | HAN_FUN_DIMMABLE_BULB |
+| color | Color | Color lights | FRITZ!DECT 500, HAN_FUN_COLOR_BULB |
+| color_temperature | Dimmer | Color temperature of lights in *white mode* | FRITZ!DECT 500, HAN_FUN_COLOR_BULB |
+| color_temperature_abs | Number:Temperature | Color temperature of lights in *white mode* in Kelvin **Advanced** | FRITZ!DECT 500, HAN_FUN_COLOR_BULB |
+| actual_temp | Number:Temperature | Current temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
+| set_temp | Number:Temperature | Set Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
+| eco_temp | Number:Temperature | Eco Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
+| comfort_temp | Number:Temperature | Comfort Temperature of heating thermostat | FRITZ!DECT 30x, Comet DECT |
+| radiator_mode | String | Mode of heating thermostat (ON/OFF/COMFORT/ECO/BOOST/WINDOW_OPEN) | FRITZ!DECT 30x, Comet DECT |
+| next_change | DateTime | Next change of the Set Temperature if scheduler is activated in the FRITZ!Box settings - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT |
+| next_temp | Number:Temperature | Next Set Temperature if scheduler is activated in the FRITZ!Box settings - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT |
+| battery_level | Number | Battery level (in %) - FRITZ!OS 7 | FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 400, FRITZ!DECT 440 |
+| battery_low | Switch | Battery level low (ON/OFF) - FRITZ!OS 6.80 | FRITZ!DECT 30x, Comet DECT, FRITZ!DECT 400, FRITZ!DECT 440 |
+| contact_state | Contact | Contact state information (OPEN/CLOSED). | HAN-FUN contact (e.g. SmartHome Tür-/Fensterkontakt or SmartHome Bewegungsmelder)- FRITZ!OS 7 |
+| last_change | DateTime | States the last time the button was pressed. | FRITZ!DECT 400, FRITZ!DECT 440, HAN-FUN switch (e.g. SmartHome Wandtaster) - FRITZ!OS 7 |
+| rollershutter | Rollershutter | Rollershutter control and status. Accepts UP/DOWN/STOP commands and the opening level in percent. States the opening level in percent. | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
+| obstruction_alarm | Obstruction Alarm | Rollershutter obstruction alarm (ON/OFF) | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
+| temperature_alarm | Temperature Alarm | Rollershutter temperature alarm (ON/OFF) | HAN-FUN blind (e.g. Rolltron DECT 1213) - FRITZ!OS 7 |
### Triggers
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/AVMFritzBindingConstants.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/AVMFritzBindingConstants.java
index 6b07e12d2..d61f59437 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/AVMFritzBindingConstants.java
+++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/AVMFritzBindingConstants.java
@@ -143,6 +143,8 @@ public class AVMFritzBindingConstants {
public static final String CHANNEL_LAST_CHANGE = "last_change";
public static final String CHANNEL_ROLLERSHUTTER = "rollershutter";
public static final String CHANNEL_COLOR = "color";
+ public static final String CHANNEL_COLORTEMPERATURE = "color_temperature";
+ public static final String CHANNEL_COLORTEMPERATURE_ABS = "color_temperature_abs";
public static final String CHANNEL_BRIGHTNESS = "brightness";
public static final String CHANNEL_ON_OFF = "on_off";
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java
index c8b9c7830..81baa1da7 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java
+++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java
@@ -12,8 +12,50 @@
*/
package org.openhab.binding.avmfritz.internal.handler;
-import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.*;
-import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.*;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.BINDING_ID;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_ACTUALTEMP;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_BATTERY;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_BATTERY_LOW;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_BRIGHTNESS;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_COLOR;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_COLORTEMPERATURE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_COLORTEMPERATURE_ABS;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_COMFORTTEMP;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_CONTACT_STATE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_DEVICE_LOCKED;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_ECOTEMP;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_ENERGY;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_HUMIDITY;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_LAST_CHANGE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_LOCKED;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_MODE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_NEXTTEMP;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_NEXT_CHANGE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_OBSTRUCTION_ALARM;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_ON_OFF;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_OUTLET;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_POWER;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_RADIATOR_MODE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_ROLLERSHUTTER;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_SETTEMP;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_TEMPERATURE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_TEMPERATURE_ALARM;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CHANNEL_VOLTAGE;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.CONFIG_CHANNEL_TEMP_OFFSET;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_BOOST;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_COMFORT;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_ECO;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_OFF;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_ON;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_UNKNOWN;
+import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.MODE_WINDOW_OPEN;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.TEMP_FRITZ_MAX;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.TEMP_FRITZ_OFF;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.TEMP_FRITZ_ON;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.TEMP_FRITZ_UNDEFINED;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.fromCelsius;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.normalizeCelsius;
+import static org.openhab.binding.avmfritz.internal.dto.HeatingModel.toCelsius;
import java.math.BigDecimal;
import java.time.Instant;
@@ -82,6 +124,8 @@ import org.slf4j.LoggerFactory;
* @author Christoph Weitkamp - Added support for AVM FRITZ!DECT 300 and Comet DECT
* @author Christoph Weitkamp - Added support for groups
* @author Ulrich Mertin - Added support for HAN-FUN blinds
+ * @author Christoph Sommer - Added support for color temperature
+ * @author Tobias Lange - Added abs color temperature and fixed on/off behavior of light blub
*/
@NonNullByDefault
public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implements FritzAhaStatusListener {
@@ -161,7 +205,8 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
if (deviceModel.isHANFUNBlinds()) {
updateLevelControl(deviceModel.getLevelControlModel());
} else if (deviceModel.isColorLight()) {
- updateColorLight(deviceModel.getColorControlModel(), deviceModel.getLevelControlModel());
+ updateColorLight(deviceModel.getColorControlModel(), deviceModel.getLevelControlModel(),
+ deviceModel.getSimpleOnOffUnit());
} else if (deviceModel.isDimmableLight() && !deviceModel.isHANFUNBlinds()) {
updateDimmableLight(deviceModel.getLevelControlModel());
} else if (deviceModel.isHANFUNUnit() && deviceModel.isHANFUNOnOff()) {
@@ -218,12 +263,28 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
}
private void updateColorLight(@Nullable ColorControlModel colorControlModel,
- @Nullable LevelControlModel levelControlModel) {
- if (colorControlModel != null && levelControlModel != null) {
+ @Nullable LevelControlModel levelControlModel, @Nullable SimpleOnOffModel simpleOnOff) {
+ if (colorControlModel != null && levelControlModel != null && simpleOnOff != null) {
DecimalType hue = new DecimalType(colorControlModel.hue);
PercentType saturation = ColorControlModel.toPercent(colorControlModel.saturation);
- PercentType brightness = new PercentType(levelControlModel.getLevelPercentage());
+ PercentType brightness;
+ if (simpleOnOff.state) {
+ brightness = new PercentType(levelControlModel.getLevelPercentage());
+ } else {
+ brightness = PercentType.ZERO;
+ }
updateThingChannelState(CHANNEL_COLOR, new HSBType(hue, saturation, brightness));
+
+ if (colorControlModel.currentMode == 4) {
+ int temperature = colorControlModel.temperature;
+ int tempMired = 1000000 / temperature;
+ int tempMinMired = 1000000 / 2700;
+ int tempMaxMired = 1000000 / 6500;
+ int pct = (tempMired - tempMinMired) * 100 / (tempMaxMired - tempMinMired);
+ updateThingChannelState(CHANNEL_COLORTEMPERATURE, new PercentType(pct));
+ updateThingChannelState(CHANNEL_COLORTEMPERATURE_ABS,
+ new QuantityType<>(BigDecimal.valueOf(temperature), Units.KELVIN));
+ }
}
}
@@ -454,7 +515,41 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
}
}
if (brightness != null) {
- fritzBox.setLevelPercentage(ain, brightness);
+ if (brightness.equals(BigDecimal.ZERO)) {
+ fritzBox.setSwitch(ain, false);
+ } else {
+ fritzBox.setSwitch(ain, true);
+ fritzBox.setLevelPercentage(ain, brightness);
+ }
+ }
+ break;
+ case CHANNEL_COLORTEMPERATURE:
+ BigDecimal colorTemperaturePct = null;
+ if (command instanceof PercentType) {
+ colorTemperaturePct = ((PercentType) command).toBigDecimal();
+ }
+ if (colorTemperaturePct != null) {
+ int pct = colorTemperaturePct.intValue();
+ // AHA-HTTP-Inteface docu say that the values typically between 2700K and 6500K
+ int tempMinMired = 1000000 / 2700;
+ int tempMaxMired = 1000000 / 6500;
+ int tempScaledMired = tempMinMired + ((tempMaxMired - tempMinMired) * pct / 100);
+ int tempKelvin = 1000000 / tempScaledMired;
+ fritzBox.setColorTemperature(ain, tempKelvin, 0);
+ }
+ break;
+ case CHANNEL_COLORTEMPERATURE_ABS:
+ BigDecimal colorTemperature = null;
+ if (command instanceof QuantityType) {
+ QuantityType> convertedCommand = ((QuantityType>) command).toInvertibleUnit(Units.KELVIN);
+ if (convertedCommand != null) {
+ colorTemperature = convertedCommand.toBigDecimal();
+ }
+ } else if (command instanceof DecimalType) {
+ colorTemperature = ((DecimalType) command).toBigDecimal();
+ }
+ if (colorTemperature != null) {
+ fritzBox.setColorTemperature(ain, colorTemperature.intValue(), 0);
}
break;
case CHANNEL_SETTEMP:
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzAhaWebInterface.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzAhaWebInterface.java
index 73de6bf7a..a8ebfe3bb 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzAhaWebInterface.java
+++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzAhaWebInterface.java
@@ -35,6 +35,7 @@ import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaCallback
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetBlindTargetCallback;
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetBlindTargetCallback.BlindCommand;
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetColorCallback;
+import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetColorTemperatureCallback;
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetHeatingModeCallback;
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetHeatingTemperatureCallback;
import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaSetLevelPercentageCallback;
@@ -53,6 +54,7 @@ import org.slf4j.LoggerFactory;
* DECT
* @author Christoph Weitkamp - Added support for groups
* @author Ulrich Mertin - Added support for HAN-FUN blinds
+ * @author Christoph Sommer - Added support for color temperature
*/
@NonNullByDefault
public class FritzAhaWebInterface {
@@ -340,6 +342,12 @@ public class FritzAhaWebInterface {
return asyncGet(callback);
}
+ public FritzAhaContentExchange setColorTemperature(String ain, int temperature, int duration) {
+ FritzAhaSetColorTemperatureCallback callback = new FritzAhaSetColorTemperatureCallback(this, ain, temperature,
+ duration);
+ return asyncGet(callback);
+ }
+
public FritzAhaContentExchange setBlind(String ain, BlindCommand command) {
FritzAhaSetBlindTargetCallback callback = new FritzAhaSetBlindTargetCallback(this, ain, command);
return asyncGet(callback);
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetColorTemperatureCallback.java b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetColorTemperatureCallback.java
new file mode 100644
index 000000000..476c24344
--- /dev/null
+++ b/bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetColorTemperatureCallback.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.avmfritz.internal.hardware.callbacks;
+
+import static org.eclipse.jetty.http.HttpMethod.GET;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.avmfritz.internal.hardware.FritzAhaWebInterface;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Callback implementation for updating colortemperature. Supports reauthorization
+ *
+ * @author Christoph Sommer - Initial contribution
+ */
+@NonNullByDefault
+public class FritzAhaSetColorTemperatureCallback extends FritzAhaReauthCallback {
+
+ private final Logger logger = LoggerFactory.getLogger(FritzAhaSetColorTemperatureCallback.class);
+
+ private final String ain;
+
+ /**
+ * Constructor
+ *
+ * @param webIface Interface to FRITZ!Box
+ * @param ain AIN of the device that should be switched
+ * @param temperature Color Temperature in Kelvin (typ.: 2700 to 6500)
+ * @param duration Duration of the change in 100ms. 0 immediately.
+ */
+ public FritzAhaSetColorTemperatureCallback(FritzAhaWebInterface webIface, String ain, int temperature,
+ int duration) {
+ super(WEBSERVICE_PATH,
+ "switchcmd=setcolortemperature&temperature=" + temperature + "&duration=" + duration + "&ain=" + ain,
+ webIface, GET, 1);
+ this.ain = ain;
+ }
+
+ @Override
+ public void execute(int status, String response) {
+ super.execute(status, response);
+ if (isValidRequest()) {
+ logger.debug("Received response '{}' for item '{}'", response, ain);
+ }
+ }
+}
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml
index 26d8691be..482bc3b6c 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml
+++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml
@@ -15,8 +15,14 @@
+
+
+
+ 1
+
+
ain
@@ -411,8 +417,14 @@
+
+
+
+ 1
+
+
ain
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml
index 21263d92c..dc034a860 100644
--- a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml
+++ b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml
@@ -113,4 +113,26 @@
+
+
+
+ system:color-temperature
+
+
+ system:color-temperature-abs
+
+
+
+
+
+
+
+ system:color-temperature
+
+
+ system:color-temperature-abs
+
+
+
+