diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/ChannelConfig.java b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/ChannelConfig.java
index 05b932220fb..0b2cb3f5486 100644
--- a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/ChannelConfig.java
+++ b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/ChannelConfig.java
@@ -57,7 +57,11 @@ public class ChannelConfig {
public @Nullable String on;
public @Nullable String off;
public @Nullable String stop;
+ public @Nullable String onState;
+ public @Nullable String offState;
public int onBrightness = 10;
public String colorMode = ColorMode.HSB.toString();
+ public boolean invert = false;
+ public boolean transformExtentsToString = false;
}
diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/RollershutterValue.java b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/RollershutterValue.java
index fbd2ba64ddb..f1f34e82867 100644
--- a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/RollershutterValue.java
+++ b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/RollershutterValue.java
@@ -71,8 +71,16 @@ public class RollershutterValue extends Value {
this.upCommandString = upCommandString;
this.downCommandString = downCommandString;
this.stopCommandString = stopCommandString;
- this.upStateString = upStateString;
- this.downStateString = downStateString;
+ if (upStateString == null) {
+ this.upStateString = upCommandString;
+ } else {
+ this.upStateString = upStateString;
+ }
+ if (downStateString == null) {
+ this.downStateString = downCommandString;
+ } else {
+ this.downStateString = downStateString;
+ }
this.inverted = inverted;
this.transformExtentsToString = transformExtentsToString;
}
diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/ValueFactory.java b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/ValueFactory.java
index a189c297662..f4295b9862a 100644
--- a/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/ValueFactory.java
+++ b/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/ValueFactory.java
@@ -76,7 +76,8 @@ public class ValueFactory {
value = new OpenCloseValue(config.on, config.off);
break;
case MqttBindingConstants.ROLLERSHUTTER:
- value = new RollershutterValue(config.on, config.off, config.stop);
+ value = new RollershutterValue(config.on, config.off, config.stop, config.onState, config.offState,
+ config.invert, config.transformExtentsToString);
break;
case MqttBindingConstants.TRIGGER:
config.trigger = true;
diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/config/rollershutter-channel-config.xml b/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/config/rollershutter-channel-config.xml
index a081caa4e55..bde8aa507b2 100644
--- a/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/config/rollershutter-channel-config.xml
+++ b/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/config/rollershutter-channel-config.xml
@@ -19,7 +19,8 @@
- An MQTT topic that this thing will send a command to. If not set, this will be a read-only switch.
+ An MQTT topic that this thing will send a command to. If not set, this will be a read-only
+ rollershutter.
@@ -79,23 +80,50 @@
true
-
- A string (like "OPEN") that is recognised as UP state. You can use this parameter for a second keyword,
- next to UP.
+
+ A string (like "OPEN") that is sent when commanding the rollershutter to open. If not provided, 0 (or
+ 100, if inverted) will be sent instead.true
-
- A string (like "CLOSE") that is recognised as DOWN state. You can use this parameter for a second
- keyword, next to DOWN.
+
+ A string (like "CLOSE") that is sent when commanding the rollershutter to close. If not provided, 100
+ (or 0, if inverted) will be sent instead.true
-
- A string (like "STOP") that is recognised as stop state. Will set the rollershutter state to undefined,
- because the current position is unknown at that point.
+
+ A string (like "STOP") that is sent when commanding the rollershutter to stop.STOPtrue
+
+
+ A string (like "OPENED") that is recognised as UP state. You can use this parameter for a second
+ keyword, next to UP. Defaults to the Up Command Value.
+ true
+
+
+
+ A string (like "CLOSED") that is recognised as DOWN state. You can use this parameter for a second
+ keyword, next to DOWN. Defaults to the Down Command Value.
+ true
+
+
+
+ Enable if your device uses 100 as UP and 0 as DOWN, instead of the normal openHAB convention of 0 as UP
+ and 100 as DOWN.
+ false
+ true
+
+
+
+ If a command is 0 or 100, send that as UP or DOWN commands instead. Useful if your device doesn't
+ support going to a specific position - only opening or closing, but you have front ends (say HomeKit) or rules that
+ will only send percentage commands instead of UP/DOWN.
+
+ false
+ true
+
diff --git a/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/i18n/mqtt.properties b/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/i18n/mqtt.properties
index f02c9b5dc50..80fd9264a23 100644
--- a/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/i18n/mqtt.properties
+++ b/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/i18n/mqtt.properties
@@ -128,15 +128,21 @@ thing-type.config.mqtt.number_channel.transformationPatternOut.description = App
thing-type.config.mqtt.number_channel.unit.label = Unit Of Measurement
thing-type.config.mqtt.number_channel.unit.description = Unit of measurement (optional). The unit is used for representing the value in the GUI as well as for converting incoming values (like from '°F' to '°C'). Examples: "°C", "°F"
thing-type.config.mqtt.rollershutter_channel.commandTopic.label = MQTT Command Topic
-thing-type.config.mqtt.rollershutter_channel.commandTopic.description = An MQTT topic that this thing will send a command to. If not set, this will be a read-only switch.
+thing-type.config.mqtt.rollershutter_channel.commandTopic.description = An MQTT topic that this thing will send a command to. If not set, this will be a read-only rollershutter.
thing-type.config.mqtt.rollershutter_channel.formatBeforePublish.label = Outgoing Value Format
thing-type.config.mqtt.rollershutter_channel.formatBeforePublish.description = Format a value before it is published to the MQTT broker. The default is to just pass the channel/item state. If you want to apply a prefix, say "MYCOLOR,", you would use "MYCOLOR,%s". If you want to adjust the precision of a number to for example 4 digits, you would use "%.4f".
thing-type.config.mqtt.rollershutter_channel.group.transformations.label = Transform Values
thing-type.config.mqtt.rollershutter_channel.group.transformations.description = These configuration parameters allow you to alter a value before it is published to MQTT or before a received value is assigned to an item.
-thing-type.config.mqtt.rollershutter_channel.off.label = Down Value
-thing-type.config.mqtt.rollershutter_channel.off.description = A string (like "CLOSE") that is recognised as DOWN state. You can use this parameter for a second keyword, next to DOWN.
-thing-type.config.mqtt.rollershutter_channel.on.label = Up Value
-thing-type.config.mqtt.rollershutter_channel.on.description = A string (like "OPEN") that is recognised as UP state. You can use this parameter for a second keyword, next to UP.
+thing-type.config.mqtt.rollershutter_channel.invert.label = Invert
+thing-type.config.mqtt.rollershutter_channel.invert.description = Enable if your device uses 100 as UP and 0 as DOWN, instead of the normal openHAB convention of 0 as UP and 100 as DOWN.
+thing-type.config.mqtt.rollershutter_channel.off.label = Down Command Value
+thing-type.config.mqtt.rollershutter_channel.off.description = A string (like "CLOSE") that is sent when commanding the rollershutter to close. If not provided, 100 (or 0, if inverted) will be sent instead.
+thing-type.config.mqtt.rollershutter_channel.offState.label = Down State Value
+thing-type.config.mqtt.rollershutter_channel.offState.description = A string (like "CLOSED") that is recognised as DOWN state. You can use this parameter for a second keyword, next to DOWN. Defaults to the Down Command Value.
+thing-type.config.mqtt.rollershutter_channel.on.label = Up Command Value
+thing-type.config.mqtt.rollershutter_channel.on.description = A string (like "OPEN") that is sent when commanding the rollershutter to open. If not provided, 0 (or 100, if inverted) will be sent instead.
+thing-type.config.mqtt.rollershutter_channel.onState.label = Up State Value
+thing-type.config.mqtt.rollershutter_channel.onState.description = A string (like "OPENED") that is recognised as UP state. You can use this parameter for a second keyword, next to UP. Defaults to the Up Command Value.
thing-type.config.mqtt.rollershutter_channel.postCommand.label = Is Command
thing-type.config.mqtt.rollershutter_channel.postCommand.description = If the received MQTT value should not only update the state of linked items, but command them, enable this option.
thing-type.config.mqtt.rollershutter_channel.qos.label = QoS
@@ -148,8 +154,10 @@ thing-type.config.mqtt.rollershutter_channel.retained.label = Retained
thing-type.config.mqtt.rollershutter_channel.retained.description = The value will be published to the command topic as retained message. A retained value stays on the broker and can even be seen by MQTT clients that are subscribing at a later point in time.
thing-type.config.mqtt.rollershutter_channel.stateTopic.label = MQTT State Topic
thing-type.config.mqtt.rollershutter_channel.stateTopic.description = An MQTT topic that this thing will subscribe to, to receive the state. This can be left empty, the channel will be state-less command-only channel.
-thing-type.config.mqtt.rollershutter_channel.stop.label = Stop Value
-thing-type.config.mqtt.rollershutter_channel.stop.description = A string (like "STOP") that is recognised as stop state. Will set the rollershutter state to undefined, because the current position is unknown at that point.
+thing-type.config.mqtt.rollershutter_channel.stop.label = Stop Command
+thing-type.config.mqtt.rollershutter_channel.stop.description = A string (like "STOP") that is sent when commanding the rollershutter to stop.
+thing-type.config.mqtt.rollershutter_channel.transformExtentsToString.label = Transform Commands at Extents to String
+thing-type.config.mqtt.rollershutter_channel.transformExtentsToString.description = If a command is 0 or 100, send that as UP or DOWN commands instead. Useful if your device doesn't support going to a specific position - only opening or closing, but you have front ends (say HomeKit) or rules that will only send percentage commands instead of UP/DOWN.
thing-type.config.mqtt.rollershutter_channel.transformationPattern.label = Incoming Value Transformations
thing-type.config.mqtt.rollershutter_channel.transformationPattern.description = Applies transformations to an incoming MQTT topic value. A transformation example for a received JSON would be "JSONPATH:$.device.status.temperature" for a json {device: {status: { temperature: 23.2 }}}. You can chain transformations by separating them with the intersection character ∩.
thing-type.config.mqtt.rollershutter_channel.transformationPatternOut.label = Outgoing Value Transformation