From: Fabian Wolter Date: Fri, 11 Nov 2022 09:12:32 +0000 (+0100) Subject: [lcn] Fix setting of variables (#13690) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=3ed44f1ba5abbe8e0af74c427543e7c4a3d2a73e;p=openhab-addons.git [lcn] Fix setting of variables (#13690) Signed-off-by: Fabian Wolter --- diff --git a/bundles/org.openhab.binding.lcn/README.md b/bundles/org.openhab.binding.lcn/README.md index 35fa8c774e..03534af0de 100644 --- a/bundles/org.openhab.binding.lcn/README.md +++ b/bundles/org.openhab.binding.lcn/README.md @@ -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 diff --git a/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/PckGenerator.java b/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/PckGenerator.java index 62bd7b8f2c..988b147d6b 100644 --- a/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/PckGenerator.java +++ b/bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/common/PckGenerator.java @@ -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 {