]> git.basschouten.com Git - openhab-addons.git/commitdiff
[enocean] Add support for eltako rollershutter frm60 (#10852)
authorhofingerandi <47886894+hofingerandi@users.noreply.github.com>
Mon, 21 Jun 2021 20:31:42 +0000 (22:31 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Jun 2021 20:31:42 +0000 (22:31 +0200)
* added eltako frm60, based on eltako fsb

Signed-off-by: Andreas Hofinger <andreas.hofinger@gmx.net>
bundles/org.openhab.binding.enocean/README.md
bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFRM.java [new file with mode: 0644]
bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPType.java
bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/Rollershutter.xml

index a32ab02b157b4c750627ab87d56c1cba012e40ef..ba21f39f03d97d9e681600c5d77f2f95ec0c8013 100644 (file)
@@ -213,9 +213,9 @@ If you change the SenderId of your thing, you have to pair again the thing with
 |                                 | suppressRepeating | Suppress repeating of msg   | true, false |
 | rollershutter                   | senderIdOffset    |                             | 1-127 |
 |                                 | enoceanId         | | |
-|                                 | sendingEEPId      |                             | A5_3F_7F_EltakoFSB, A5_38_08_07, D2_05_00 |
+|                                 | sendingEEPId      |                             | A5_3F_7F_EltakoFSB, A5_3F_7F_EltakoFRM, A5_38_08_07, D2_05_00 |
 |                                 | broadcastMessages |                             | true, false |
-|                                 | receivingEEPId¹   |                             | A5_3F_7F_EltakoFSB, A5_11_03, D2_05_00 |
+|                                 | receivingEEPId¹   |                             | A5_3F_7F_EltakoFSB, A5_3F_7F_EltakoFRM, A5_11_03, D2_05_00 |
 |                                 | suppressRepeating |                             | true, false |
 |                                 | pollingInterval   | Refresh interval in seconds | Integer |
 | measurementSwitch               | senderIdOffset    |                             | 1-127 |
diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFRM.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFRM.java
new file mode 100644 (file)
index 0000000..0ef03f4
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2010-2021 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.enocean.internal.eep.A5_3F;
+
+import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.ZERO;
+
+import java.util.function.Function;
+
+import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
+import org.openhab.binding.enocean.internal.messages.ERP1Message;
+import org.openhab.core.config.core.Configuration;
+import org.openhab.core.library.types.PercentType;
+import org.openhab.core.library.types.StopMoveType;
+import org.openhab.core.library.types.UpDownType;
+import org.openhab.core.types.Command;
+import org.openhab.core.types.State;
+import org.openhab.core.types.UnDefType;
+
+/**
+ *
+ * @author Andreas Hofinger
+ */
+public class A5_3F_7F_EltakoFRM extends _4BSMessage {
+
+    static final byte Stop = 0x00;
+    static final byte Move = 0x03;
+
+    static final int Top = 0xC8;
+    static final int Bottom = 0x00;
+
+    public A5_3F_7F_EltakoFRM() {
+        super();
+    }
+
+    public A5_3F_7F_EltakoFRM(ERP1Message packet) {
+        super(packet);
+    }
+
+    @Override
+    protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command,
+            Function<String, State> getCurrentStateFunc, Configuration config) {
+
+        if (command instanceof PercentType) {
+            PercentType target = (PercentType) command;
+            int rawPosition = Math.round(
+                    (PercentType.HUNDRED.floatValue() - target.floatValue()) * Top / PercentType.HUNDRED.floatValue());
+            int position = Math.min(Top, Math.max(Bottom, rawPosition));
+            setData((byte) position, ZERO, Move, TeachInBit);
+        } else if (command instanceof UpDownType) {
+            if ((UpDownType) command == UpDownType.UP) {
+                setData((byte) Top, ZERO, Move, TeachInBit); // => 0 percent
+            } else if ((UpDownType) command == UpDownType.DOWN) {
+                setData((byte) Bottom, ZERO, Move, TeachInBit); // => 100 percent
+            }
+        } else if (command instanceof StopMoveType) {
+            if ((StopMoveType) command == StopMoveType.STOP) {
+                setData(ZERO, ZERO, Stop, TeachInBit);
+            }
+        }
+    }
+
+    @Override
+    protected State convertToStateImpl(String channelId, String channelTypeId,
+            Function<String, State> getCurrentStateFunc, Configuration config) {
+
+        // 0x0A.. Move was locked for switch
+        // 0x0E.. Move was not locked
+        if (getDB_2() == ZERO && getDB_1() == Move && (getDB_0() == 0x0A || getDB_0() == 0x0E)) {
+            int position = getDB_3Value();
+            float percentage = 100.0f * (Top - position) / (float) (Top - Bottom);
+            return new PercentType(Math.round(Math.min(100, (Math.max(0, percentage)))));
+        }
+        return UnDefType.UNDEF;
+    }
+}
index 26c461ae8257c5ca6fd8779b1c7ebb9813597454..69acb5382a6d0d49a000131c261f51fa0ccd14ad 100644 (file)
@@ -108,6 +108,7 @@ import org.openhab.binding.enocean.internal.eep.A5_30.A5_30_03_ELTAKO;
 import org.openhab.binding.enocean.internal.eep.A5_38.A5_38_08_Blinds;
 import org.openhab.binding.enocean.internal.eep.A5_38.A5_38_08_Dimming;
 import org.openhab.binding.enocean.internal.eep.A5_38.A5_38_08_Switching;
+import org.openhab.binding.enocean.internal.eep.A5_3F.A5_3F_7F_EltakoFRM;
 import org.openhab.binding.enocean.internal.eep.A5_3F.A5_3F_7F_EltakoFSB;
 import org.openhab.binding.enocean.internal.eep.Base.PTM200Message;
 import org.openhab.binding.enocean.internal.eep.Base.UTEResponse;
@@ -399,6 +400,19 @@ public enum EEPType {
                 }
             }),
 
+    EltakoFRM(RORG._4BS, 0x3f, 0x7f, false, false, "EltakoFRM", 0, A5_3F_7F_EltakoFRM.class, THING_TYPE_ROLLERSHUTTER,
+            0, new Hashtable<String, Configuration>() {
+                private static final long serialVersionUID = 1L;
+                {
+                    put(CHANNEL_ROLLERSHUTTER, new Configuration());
+                    put(CHANNEL_TEACHINCMD, new Configuration() {
+                        {
+                            put(PARAMETER_CHANNEL_TeachInMSG, "fff80d80");
+                        }
+                    });
+                }
+            }),
+
     Thermostat(RORG._4BS, 0x20, 0x04, false, true, A5_20_04.class, THING_TYPE_THERMOSTAT, CHANNEL_VALVE_POSITION,
             CHANNEL_BUTTON_LOCK, CHANNEL_DISPLAY_ORIENTATION, CHANNEL_TEMPERATURE_SETPOINT, CHANNEL_TEMPERATURE,
             CHANNEL_FEED_TEMPERATURE, CHANNEL_MEASUREMENT_CONTROL, CHANNEL_FAILURE_CODE, CHANNEL_WAKEUPCYCLE,
index b0f00d97962fbc261d88f08c9689a0ead2b94ce5..e7d572375fe7b70852cb2711dff6ed47dcba9547 100644 (file)
@@ -31,6 +31,7 @@
                                <label>EEP for Sending Commands</label>
                                <options>
                                        <option value="A5_3F_7F_EltakoFSB">Eltako FSB14/61/71</option>
+                                       <option value="A5_3F_7F_EltakoFRM">Eltako FRM60</option>
                                        <option value="D2_05_00">D2-05-00 Rollershutter (like SIN-2-RS-01)</option>
                                        <option value="A5_38_08_07">Gateway command - blinds (A5_38_08 sub command 0x07)</option>
                                </options>
@@ -45,6 +46,7 @@
                                <label>EEP for Receiving States</label>
                                <options>
                                        <option value="A5_3F_7F_EltakoFSB">Eltako FSB14/61/71</option>
+                                       <option value="A5_3F_7F_EltakoFRM">Eltako FRM60</option>
                                        <option value="D2_05_00">D2-05-00 Rollershutter (like SIN-2-RS-01)</option>
                                        <option value="A5_11_03">A5-11-03 Rollershutter status</option>
                                        <option value="F6_00_00">PTM200 Rollershutter status</option>