]> git.basschouten.com Git - openhab-addons.git/commitdiff
[lcn] Fix setting of variables (#13690)
authorFabian Wolter <github@fabian-wolter.de>
Fri, 11 Nov 2022 09:12:32 +0000 (10:12 +0100)
committerGitHub <noreply@github.com>
Fri, 11 Nov 2022 09:12:32 +0000 (10:12 +0100)
Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
bundles/org.openhab.binding.lcn/README.md
bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/PckGenerator.java

index 35fa8c774e6d72959ae4abe398d27558fabe4ee6..03534af0de4fef08cb61853b169270648f028498 100644 (file)
@@ -140,7 +140,7 @@ If a special command is needed, the [Hit Key](#hit-key) action (German: "Sende T
 | Motor/Shutter on Dimmer Outputs | Motor/Rollladen an Ausgängen     | rollershutteroutput    | 1-4  | Rollershutter                  | Control roller shutters on dimmer outputs                                                                                     |
 | Motor/Shutter on Relays         | Motor/Rollladen an Relais        | rollershutterrelay     | 1-4  | Rollershutter, Dimmer          | Control position of roller shutters on relays (Supports UpDown, StopMove, Percent)                                            |
 | Shutter Slat Angle on Relays    | Rollladenlamellen an Relais      | rollershutterrelayslat | 1-4  | Rollershutter, Dimmer          | Control slat angle of roller shutters on relays (Supports UpDown, StopMove, Percent)                                          |
-| Variables                       | Variable anzeigen                | variable               | 1-12 | Number                         | Sets and visualizes the value of a variable.                                                                                  |
+| Variables                       | Variable anzeigen                | variable               | 1-12 | Number                         | Sets and visualizes the value of a variable. See note.                                                                        |
 | Regulator Set Setpoint          | Regler Sollwert ändern           | rvarsetpoint           | 1-2  | Number                         | Sets and visualizes the setpoint of a regulator.                                                                              |
 | Regulator Set Mode              | Reglerverhalten ändern           | rvarmode               | 1-2  | String                         | Sets the mode of the regulator: `HEATING` or `COOLING`                                                                        |
 | Regulator Lock                  | Regler sperren                   | rvarlock               | 1-2  | Switch                         | Locks a regulator and visualizes its locking state.                                                                           |
@@ -194,13 +194,13 @@ If a special command is needed, the [Hit Key](#hit-key) action (German: "Sende T
 | Set S0 Counters                 | S0-Zähler setzen                 | -                      | -    | -                              | Not implemented                                                                                                               |
 | Status Command                  | Statuskommandos                  | -                      | -    | -                              | Not implemented                                                                                                               |
 
-**For some *Channel*s a unit should be configured for visualization.** By default the native LCN value is used.
+*Notes:*
 
-S0 counter Channels need to be the pulses per kWh configured. If the value is left blank, a default value of 1000 pulses/kWh is set.
-
-The Rollershutter Channels provide the boolean parameter `invertUpDown`, which can be set to 'true' if the Up/Down wires are interchanged.
-
-The binary sensor Channels provide the boolean parameter `invertState`, which can be set to 'true' if the binary sensor connected uses inverted logic for signaling open/closed.
+- **For some *Channel*s (e.g. temperature) a unit should be configured in the channel configuration.** By default the native LCN value is used.
+- S0 counter Channels need to be the pulses per kWh configured. If the value is left blank, a default value of 1000 pulses/kWh is set.
+- When setting a variable via openHAB, the variable must be configured as counter in LCN-PRO. The variable must be set initially by the module after power up.
+- The Rollershutter Channels provide the boolean parameter `invertUpDown`, which can be set to 'true' if the Up/Down wires are interchanged.
+The binary sensor Channels provide the boolean parameter `invertState`, which can be set to 'true' if the binary sensor connected uses inverted logic for signaling open/closed.
 
 ### Transponder/Fingerprints
 
index 62bd7b8f2c7b0f26befec6337ad6bcb2c38fd4ce..988b147d6b52670e2835ecdbe4f4cf568d9cb3a7 100644 (file)
@@ -513,13 +513,13 @@ public final class PckGenerator {
                 case UNKNOWN:
                     throw new LcnException("Variable unknown");
                 case VARIABLE:
-                    return String.format("MWT%03d", id + 1);
+                    return "MWT" + (id + 1);
                 case REGULATOR:
-                    return String.format("MWS%03d", id + 1);
+                    return "MWS" + (id + 1);
                 case THRESHOLD:
-                    return String.format("SE%03d", id + 1); // Whole register
+                    return "SE" + (id + 1); // Whole register
                 case S0INPUT:
-                    return String.format("MWC%03d", id + 1);
+                    return "MWC" + (id + 1);
             }
             throw new LcnException("Unsupported variable type: " + variable);
         } else {