]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homematic] Remove state description step size handling (#12192)
authormaniac103 <dannybaumann@web.de>
Sun, 6 Feb 2022 19:21:59 +0000 (20:21 +0100)
committerGitHub <noreply@github.com>
Sun, 6 Feb 2022 19:21:59 +0000 (20:21 +0100)
The RPC protocol doesn't provide this value, so it always was made up
more or less arbitrarily. Since the UI now uses this value for
validation purposes, there are cases where valid values can not be
entered due to this step size (particularly for datapoints with more
than 1 decimal digit).

Fixes #12183

Signed-off-by: Danny Baumann <dannybaumann@web.de>
bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/virtual/DisplayTextVirtualDatapoint.java
bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/model/HmDatapoint.java
bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/HomematicTypeGeneratorImpl.java

index 1c667ddb072694eaf7283f0ab2d29a948e299f5d..e44c69d194da8dbce37fb5b6fdc3285ed564377a 100644 (file)
@@ -249,7 +249,6 @@ public class DisplayTextVirtualDatapoint extends AbstractVirtualDatapointHandler
                                 HmValueType.INTEGER, 1, false);
                         bd.setMinValue(10);
                         bd.setMaxValue(160);
-                        bd.setStep(10);
                         addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_LED, Led.class);
                     }
                     addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_SUBMIT, HmValueType.BOOL, false,
index 62b0ca8b25d7763cdb98bb8a2bb3eac4c2add0e6..e334c06fc337742b4bbbefc1643692f09fa803c1 100644 (file)
@@ -31,7 +31,6 @@ public class HmDatapoint implements Cloneable {
     private HmParamsetType paramsetType;
     private Number minValue;
     private Number maxValue;
-    private Number step;
     private String[] options;
     private boolean readOnly;
     private boolean readable;
@@ -192,20 +191,6 @@ public class HmDatapoint implements Cloneable {
         this.minValue = minValue;
     }
 
-    /**
-     * Returns the step size.
-     */
-    public Number getStep() {
-        return step;
-    }
-
-    /**
-     * Sets the step size.
-     */
-    public void setStep(Number step) {
-        this.step = step;
-    }
-
     /**
      * Returns true, if the datapoint is readOnly.
      */
@@ -415,7 +400,6 @@ public class HmDatapoint implements Cloneable {
         dp.setChannel(channel);
         dp.setMinValue(minValue);
         dp.setMaxValue(maxValue);
-        dp.setStep(step);
         dp.setOptions(options);
         dp.setInfo(info);
         dp.setUnit(unit);
@@ -428,9 +412,9 @@ public class HmDatapoint implements Cloneable {
 
     @Override
     public String toString() {
-        return String.format("%s[name=%s,value=%s,defaultValue=%s,type=%s,minValue=%s,maxValue=%s,step=%s,options=%s,"
+        return String.format("%s[name=%s,value=%s,defaultValue=%s,type=%s,minValue=%s,maxValue=%s,options=%s,"
                 + "readOnly=%b,readable=%b,unit=%s,description=%s,info=%s,paramsetType=%s,virtual=%b,trigger=%b]",
-                getClass().getSimpleName(), name, value, defaultValue, type, minValue, maxValue, step,
+                getClass().getSimpleName(), name, value, defaultValue, type, minValue, maxValue,
                 (options == null ? null : String.join(";", options)), readOnly, readable, unit, description, info,
                 paramsetType, virtual, trigger);
     }
index e9fb5a541962a2721b2d1bdee4378b4ca63873e3..0ea073789b9ddbf7dd0b75298008887f9be1d7e1 100644 (file)
@@ -278,21 +278,14 @@ public class HomematicTypeGeneratorImpl implements HomematicTypeGenerator {
             if (dp.isNumberType()) {
                 BigDecimal min = MetadataUtils.createBigDecimal(dp.getMinValue());
                 BigDecimal max = MetadataUtils.createBigDecimal(dp.getMaxValue());
-                BigDecimal step = MetadataUtils.createBigDecimal(dp.getStep());
                 if (ITEM_TYPE_DIMMER.equals(itemType)
                         && (max.compareTo(new BigDecimal("1.0")) == 0 || max.compareTo(new BigDecimal("1.01")) == 0)) {
                     // For dimmers with a max value of 1.01 or 1.0 the values must be corrected
                     min = MetadataUtils.createBigDecimal(0);
                     max = MetadataUtils.createBigDecimal(100);
-                    step = MetadataUtils.createBigDecimal(1);
-                } else {
-                    if (step == null) {
-                        step = MetadataUtils
-                                .createBigDecimal(dp.isFloatType() ? Float.valueOf(0.1f) : Long.valueOf(1L));
-                    }
                 }
-                stateFragment.withMinimum(min).withMaximum(max).withStep(step)
-                        .withPattern(MetadataUtils.getStatePattern(dp)).withReadOnly(dp.isReadOnly());
+                stateFragment.withMinimum(min).withMaximum(max).withPattern(MetadataUtils.getStatePattern(dp))
+                        .withReadOnly(dp.isReadOnly());
             } else {
                 stateFragment.withPattern(MetadataUtils.getStatePattern(dp)).withReadOnly(dp.isReadOnly());
             }
@@ -361,8 +354,6 @@ public class HomematicTypeGeneratorImpl implements HomematicTypeGenerator {
                         }
                         builder.withMinimum(MetadataUtils.createBigDecimal(dp.getMinValue()));
                         builder.withMaximum(MetadataUtils.createBigDecimal(maxValue));
-                        builder.withStepSize(MetadataUtils
-                                .createBigDecimal(dp.isFloatType() ? Float.valueOf(0.1f) : Long.valueOf(1L)));
                         builder.withUnitLabel(MetadataUtils.getUnit(dp));
                     }