]> git.basschouten.com Git - openhab-addons.git/commitdiff
[rfxcom] Add Novy extractor fans (#10891)
authorJames Hewitt <james.hewitt@uk.ibm.com>
Wed, 23 Jun 2021 16:10:29 +0000 (17:10 +0100)
committerGitHub <noreply@github.com>
Wed, 23 Jun 2021 16:10:29 +0000 (18:10 +0200)
bundles/org.openhab.binding.rfxcom/README.md
bundles/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/RFXComBindingConstants.java
bundles/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComBaseMessage.java
bundles/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComFanMessage.java
bundles/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComMessageFactory.java
bundles/org.openhab.binding.rfxcom/src/main/resources/OH-INF/thing/fan_novy.xml [new file with mode: 0644]
bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComFanLucciAirDcMessageTest.java
bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComFanNovyMessage.java [new file with mode: 0644]

index 30685dc1c66165bf029134ad27d16115aa6ae165..de8f614a8a70c850f63c63870e92d764e6c49dad 100644 (file)
@@ -439,7 +439,7 @@ A DateTime device
 
 A group of fan devices
 
-#### Standard Fan
+#### fan - Standard Fan
 
 A Fan device
 
@@ -474,7 +474,7 @@ Switch item=FanLightSwitch label="Light" mappings=[ON="On"]
 Switch item=FanSpeedSwitch label="Speed" mappings=[LOW=Low, MED=Medium, HI=High]
 ```
 
-#### Falmec fan
+#### fan_falmec - Falmec fan
 
 A Falmec Fan device
 
@@ -496,7 +496,7 @@ A Falmec Fan device
     *   Specifies device sub type.
         *   FALMEC - Falmec
 
-#### Lucci Air DC fan
+#### fan_lucci_dc - Lucci Air DC fan
 
 A Lucci Air DC fan device
 
@@ -517,7 +517,7 @@ A Lucci Air DC fan device
     *   Specifies device sub type.
         *   LUCCI_AIR_DC - Lucci Air DC
 
-#### Lucci Air DC II fan
+#### fan_lucci_dc_ii - Lucci Air DC II fan
 
 A Lucci Air DC II fan device
 
@@ -538,6 +538,28 @@ A Lucci Air DC II fan device
 *   subType - Sub Type
     *   Specifies device sub type.
         *   LUCCI_AIR_DC_II - Lucci Air DC II
+        
+#### fan_novy - Novy extractor fan
+
+A Novy extractor fan.
+
+##### Channels
+
+| Name         | Channel Type                        | Item Type     | Remarks                  |
+|--------------|-------------------------------------|---------------|--------------------------|
+| command      | [command](#channels)                | Switch        |                          |
+| commandString| [commandString](#channels)          | String        | Options: POWER, UP, DOWN, LIGHT, LEARN, RESET_FILTER |
+| fanSpeed     | [fanspeedcontrol](#channels)        | RollerShutter | Options: UP / DOWN       |
+| fanLight     | [fanlight](#channels)               | Switch        |                          |
+| signalLevel  | [system.signal-strength](#channels) | Number        |                          |
+
+##### Configuration Options
+
+*   deviceId - Device Id
+    *   Device id, example 47360
+*   subType - Sub Type
+    *   Specifies device sub type.
+        *   NOVY - Novy extractor fan
 
 ### energy - RFXCOM Energy Sensor
 
index d300abab5a2587c008ea08de135270f403fbe69f..d7c67118fa711b1c8c67afe04c9849cec21be213 100644 (file)
@@ -133,6 +133,7 @@ public class RFXComBindingConstants {
     private static final ThingTypeUID THING_TYPE_FAN_FT1211R = new ThingTypeUID(BINDING_ID, "fan_ft1211r");
     private static final ThingTypeUID THING_TYPE_FAN_FALMEC = new ThingTypeUID(BINDING_ID, "fan_falmec");
     private static final ThingTypeUID THING_TYPE_FAN_LUCCI_DC_II = new ThingTypeUID(BINDING_ID, "fan_lucci_dc_ii");
+    private static final ThingTypeUID THING_TYPE_FAN_NOVY = new ThingTypeUID(BINDING_ID, "fan_novy");
     private static final ThingTypeUID THING_TYPE_FS20 = new ThingTypeUID(BINDING_ID, "fs20");
     private static final ThingTypeUID THING_TYPE_GAS_USAGE = new ThingTypeUID(BINDING_ID, "gasusage");
     private static final ThingTypeUID THING_TYPE_HOME_CONFORT = new ThingTypeUID(BINDING_ID, "homeconfort");
@@ -177,12 +178,12 @@ public class RFXComBindingConstants {
                     THING_TYPE_CAMERA1, THING_TYPE_CHIME, THING_TYPE_CURRENT, THING_TYPE_CURRENT_ENERGY,
                     THING_TYPE_CURTAIN1, THING_TYPE_DATE_TIME, THING_TYPE_ENERGY, THING_TYPE_FAN, THING_TYPE_FAN_SF01,
                     THING_TYPE_FAN_ITHO, THING_TYPE_FAN_SEAV, THING_TYPE_FAN_LUCCI_DC, THING_TYPE_FAN_FT1211R,
-                    THING_TYPE_FAN_FALMEC, THING_TYPE_FAN_LUCCI_DC_II, THING_TYPE_GAS_USAGE, THING_TYPE_HOME_CONFORT,
-                    THING_TYPE_HUMIDITY, THING_TYPE_IO_LINES, THING_TYPE_LIGHTNING1, THING_TYPE_LIGHTNING2,
-                    THING_TYPE_LIGHTNING3, THING_TYPE_LIGHTNING4, THING_TYPE_LIGHTNING5, THING_TYPE_LIGHTNING6,
-                    THING_TYPE_POWER, THING_TYPE_RADIATOR1, THING_TYPE_RAIN, THING_TYPE_RAW, THING_TYPE_REMOTE_CONTROL,
-                    THING_TYPE_RFX_METER, THING_TYPE_RFX_SENSOR, THING_TYPE_RFY, THING_TYPE_SECURITY1,
-                    THING_TYPE_SECURITY2, THING_TYPE_TEMPERATURE, THING_TYPE_TEMPERATURE_HUMIDITY,
+                    THING_TYPE_FAN_FALMEC, THING_TYPE_FAN_LUCCI_DC_II, THING_TYPE_FAN_NOVY, THING_TYPE_GAS_USAGE,
+                    THING_TYPE_HOME_CONFORT, THING_TYPE_HUMIDITY, THING_TYPE_IO_LINES, THING_TYPE_LIGHTNING1,
+                    THING_TYPE_LIGHTNING2, THING_TYPE_LIGHTNING3, THING_TYPE_LIGHTNING4, THING_TYPE_LIGHTNING5,
+                    THING_TYPE_LIGHTNING6, THING_TYPE_POWER, THING_TYPE_RADIATOR1, THING_TYPE_RAIN, THING_TYPE_RAW,
+                    THING_TYPE_REMOTE_CONTROL, THING_TYPE_RFX_METER, THING_TYPE_RFX_SENSOR, THING_TYPE_RFY,
+                    THING_TYPE_SECURITY1, THING_TYPE_SECURITY2, THING_TYPE_TEMPERATURE, THING_TYPE_TEMPERATURE_HUMIDITY,
                     THING_TYPE_TEMPERATURE_HUMIDITY_BAROMETRIC, THING_TYPE_TEMPERATURE_RAIN, THING_TYPE_THERMOSTAT1,
                     THING_TYPE_THERMOSTAT2, THING_TYPE_THERMOSTAT3, THING_TYPE_UNDECODED, THING_TYPE_UV,
                     THING_TYPE_WATER_USAGE, THING_TYPE_WEIGHTING_SCALE, THING_TYPE_WIND).collect(Collectors.toSet()));
@@ -211,6 +212,7 @@ public class RFXComBindingConstants {
                     put(PacketType.FAN_FT1211R, RFXComBindingConstants.THING_TYPE_FAN_FT1211R);
                     put(PacketType.FAN_FALMEC, RFXComBindingConstants.THING_TYPE_FAN_FALMEC);
                     put(PacketType.FAN_LUCCI_DC_II, RFXComBindingConstants.THING_TYPE_FAN_LUCCI_DC_II);
+                    put(PacketType.FAN_NOVY, RFXComBindingConstants.THING_TYPE_FAN_NOVY);
                     put(PacketType.FS20, RFXComBindingConstants.THING_TYPE_FS20);
                     put(PacketType.GAS, RFXComBindingConstants.THING_TYPE_GAS_USAGE);
                     put(PacketType.HOME_CONFORT, RFXComBindingConstants.THING_TYPE_HOME_CONFORT);
index 1f49b97f339b93ddad5f12db77857035d8ff1102..0e6d32917e06f1811161f186d475a552d5bbf849 100644 (file)
@@ -47,6 +47,8 @@ public abstract class RFXComBaseMessage implements RFXComMessage {
         FAN_SEAV(23, RFXComFanMessage.SubType.SEAV_TXS4),
         FAN_FT1211R(23, RFXComFanMessage.SubType.FT1211R),
         FAN_FALMEC(23, RFXComFanMessage.SubType.FALMEC),
+        FAN_ITHO_CVE_ECO_RFT(23, RFXComFanMessage.SubType.ITHO_CVE_ECO_RFT),
+        FAN_NOVY(23, RFXComFanMessage.SubType.NOVY),
         CURTAIN1(24),
         BLINDS1(25),
         RFY(26),
index 87c0fa6df69b6c1d0ecb6e0c6cc676645348008f..feecca8979920616acc51c72adb75c366c2e47b4 100644 (file)
@@ -41,16 +41,18 @@ import org.openhab.core.types.UnDefType;
 public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.SubType> {
 
     public enum SubType implements ByteEnumWrapper {
-        SF01(0),
-        CVE_RFT(1),
-        LUCCI_AIR_FAN(2),
-        SEAV_TXS4(3),
-        WESTINGHOUSE_7226640(4),
-        LUCCI_AIR_DC(5),
-        CASAFAN(6),
-        FT1211R(7),
-        FALMEC(8),
-        LUCCI_AIR_DC_II(9);
+        SF01(0x00),
+        CVE_RFT(0x01),
+        LUCCI_AIR_FAN(0x02),
+        SEAV_TXS4(0x03),
+        WESTINGHOUSE_7226640(0x04),
+        LUCCI_AIR_DC(0x05),
+        CASAFAN(0x06),
+        FT1211R(0x07),
+        FALMEC(0x08),
+        LUCCI_AIR_DC_II(0x09),
+        ITHO_CVE_ECO_RFT(0x0A),
+        NOVY(0x0B);
 
         private final int subType;
 
@@ -111,7 +113,14 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
         LUCCI_AIR_DC_II_SPEED_5(6, 5, LUCCI_AIR_DC_II),
         LUCCI_AIR_DC_II_SPEED_6(7, 6, LUCCI_AIR_DC_II),
         LUCCI_AIR_DC_II_LIGHT(8, LUCCI_AIR_DC_II),
-        LUCCI_AIR_DC_II_REVERSE(9, LUCCI_AIR_DC_II);
+        LUCCI_AIR_DC_II_REVERSE(9, LUCCI_AIR_DC_II),
+
+        NOVY_POWER(1, NOVY),
+        NOVY_UP(2, NOVY),
+        NOVY_DOWN(3, NOVY),
+        NOVY_LIGHT(4, NOVY),
+        NOVY_LEARN(5, NOVY),
+        NOVY_RESET_FILTER(6, NOVY);
 
         private final int command;
         private final Integer speed;
@@ -155,10 +164,10 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
     private static final List<SubType> GENERIC_SUB_TYPES = Arrays.asList(WESTINGHOUSE_7226640, CASAFAN, LUCCI_AIR_FAN);
 
     private static final List<Commands> LIGHT_ON_COMMANDS = Arrays.asList(LIGHT, LUCCI_AIR_DC_LIGHT,
-            LUCCI_AIR_DC_II_LIGHT, FALMEC_LIGHT_ON);
-    private static final List<Commands> ON_COMMANDS = Arrays.asList(Commands.HI, MED, LOW, FALMEC_SPEED_1,
-            FALMEC_SPEED_2, FALMEC_SPEED_3, FALMEC_SPEED_4, LUCCI_AIR_DC_II_SPEED_1, LUCCI_AIR_DC_II_SPEED_2,
-            LUCCI_AIR_DC_II_SPEED_3, LUCCI_AIR_DC_II_SPEED_4, LUCCI_AIR_DC_II_SPEED_5, LUCCI_AIR_DC_II_SPEED_6);
+            LUCCI_AIR_DC_II_LIGHT, FALMEC_LIGHT_ON, NOVY_LIGHT);
+    private static final List<Commands> ON_COMMANDS = Arrays.asList(HI, MED, LOW, FALMEC_SPEED_1, FALMEC_SPEED_2,
+            FALMEC_SPEED_3, FALMEC_SPEED_4, LUCCI_AIR_DC_II_SPEED_1, LUCCI_AIR_DC_II_SPEED_2, LUCCI_AIR_DC_II_SPEED_3,
+            LUCCI_AIR_DC_II_SPEED_4, LUCCI_AIR_DC_II_SPEED_5, LUCCI_AIR_DC_II_SPEED_6);
     private static final List<Commands> OFF_COMMANDS = Arrays.asList(OFF, FALMEC_POWER_OFF, LUCCI_AIR_DC_II_POWER_OFF);
 
     private SubType subType;
@@ -194,6 +203,10 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
                 return PacketType.FAN_FALMEC;
             case LUCCI_AIR_DC_II:
                 return PacketType.FAN_LUCCI_DC_II;
+            case ITHO_CVE_ECO_RFT:
+                return PacketType.FAN_ITHO_CVE_ECO_RFT;
+            case NOVY:
+                return PacketType.FAN_NOVY;
         }
         return super.getPacketType();
     }
@@ -315,9 +328,11 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
                 return new DecimalType(command.getSpeed());
 
             case LUCCI_AIR_DC_DOWN:
+            case NOVY_DOWN:
                 return UpDownType.DOWN;
 
             case LUCCI_AIR_DC_UP:
+            case NOVY_UP:
                 return UpDownType.UP;
 
             default:
@@ -367,10 +382,12 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
                 case "POWER_OFF":
                 case "UP":
                 case "DOWN":
+                case "LEARN":
                 case "LIGHT":
                 case "REVERSE":
                 case "NATURAL_FLOW":
                 case "PAIR":
+                case "RESET_FILTER":
                 case "SPEED_1":
                 case "SPEED_2":
                 case "SPEED_3":
@@ -417,6 +434,12 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
             } else {
                 return Commands.LUCCI_AIR_DC_DOWN;
             }
+        } else if (type instanceof UpDownType && subType == NOVY) {
+            if (UpDownType.UP == type) {
+                return Commands.NOVY_UP;
+            } else {
+                return Commands.NOVY_DOWN;
+            }
         }
         throw new RFXComUnsupportedChannelException("Channel " + channelId + " does not accept " + type);
     }
@@ -427,7 +450,6 @@ public class RFXComFanMessage extends RFXComDeviceMessageImpl<RFXComFanMessage.S
                 case LUCCI_AIR_FAN:
                 case CASAFAN:
                 case WESTINGHOUSE_7226640:
-                case LUCCI_AIR_DC:
                     return LIGHT;
 
                 case FALMEC:
index 0a3ec7d47bea66bc5828d57a09c0794341d108f2..231d79aa2ad07b7b4fbb406a6a06595b6f5829c3 100644 (file)
@@ -51,6 +51,7 @@ public class RFXComMessageFactory {
                     // put(PacketType.FAN_FT1211R, RFXComFanMessage.class);
                     put(PacketType.FAN_FALMEC, RFXComFanMessage.class);
                     put(PacketType.FAN_LUCCI_DC_II, RFXComFanMessage.class);
+                    put(PacketType.FAN_NOVY, RFXComFanMessage.class);
                     put(PacketType.CURTAIN1, RFXComCurtain1Message.class);
                     put(PacketType.BLINDS1, RFXComBlinds1Message.class);
                     put(PacketType.RFY, RFXComRfyMessage.class);
diff --git a/bundles/org.openhab.binding.rfxcom/src/main/resources/OH-INF/thing/fan_novy.xml b/bundles/org.openhab.binding.rfxcom/src/main/resources/OH-INF/thing/fan_novy.xml
new file mode 100644 (file)
index 0000000..c71bc11
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<thing:thing-descriptions bindingId="rfxcom"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
+       xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
+
+       <thing-type id="fan_novy">
+               <supported-bridge-type-refs>
+                       <bridge-type-ref id="bridge"/>
+                       <bridge-type-ref id="tcpbridge"/>
+                       <bridge-type-ref id="RFXtrx433"/>
+                       <bridge-type-ref id="RFXrec433"/>
+               </supported-bridge-type-refs>
+
+               <label>RFXCOM Fan Device - Novy Extractor Fan</label>
+               <description>A Novy extractor fan.</description>
+
+               <channels>
+                       <channel id="commandString" typeId="commandString"/>
+                       <channel id="fanSpeed" typeId="fanspeedcontrol"/>
+                       <channel id="fanLight" typeId="command"/>
+                       <channel id="signalLevel" typeId="system.signal-strength"/>
+               </channels>
+
+               <config-description>
+                       <parameter name="deviceId" type="text" required="true">
+                               <label>Device Id</label>
+                               <description>Unit Id. Example 1000</description>
+                       </parameter>
+                       <parameter name="subType" type="text">
+                               <label>Sub Type</label>
+                               <description>Specifies device sub type.</description>
+                               <options>
+                                       <option value="NOVY">Novy extractor fan</option>
+                               </options>
+                               <default>NOVY</default>
+                       </parameter>
+               </config-description>
+       </thing-type>
+
+</thing:thing-descriptions>
index 31a0336b0b74d3440766eab69ed3fe161613b017..f2d26d80313f79ea2eb91a052ff271459e98450b 100644 (file)
@@ -34,11 +34,6 @@ import org.openhab.core.types.UnDefType;
 @NonNullByDefault
 public class RFXComFanLucciAirDcMessageTest {
 
-    @Test
-    public void testFanLightOn() throws RFXComException {
-        testCommand(CHANNEL_FAN_LIGHT, OnOffType.ON, OnOffType.ON, null, StringType.valueOf("LIGHT"));
-    }
-
     @Test
     public void testUp() throws RFXComException {
         testCommand(CHANNEL_FAN_SPEED, UpDownType.UP, UnDefType.UNDEF, UpDownType.UP, StringType.valueOf("UP"));
diff --git a/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComFanNovyMessage.java b/bundles/org.openhab.binding.rfxcom/src/test/java/org/openhab/binding/rfxcom/internal/messages/RFXComFanNovyMessage.java
new file mode 100644 (file)
index 0000000..a1ae01b
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ * 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.rfxcom.internal.messages;
+
+import static org.openhab.binding.rfxcom.internal.RFXComBindingConstants.*;
+import static org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType.FAN_NOVY;
+import static org.openhab.binding.rfxcom.internal.messages.RFXComFanMessage.SubType.NOVY;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
+import org.openhab.core.library.types.OnOffType;
+import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.types.UpDownType;
+import org.openhab.core.types.State;
+import org.openhab.core.types.UnDefType;
+
+/**
+ * Test for RFXCom-binding
+ *
+ * @author Martin van Wingerden - Initial contribution
+ */
+@NonNullByDefault
+public class RFXComFanNovyMessage {
+
+    @Test
+    public void testUp() throws RFXComException {
+        testCommand(CHANNEL_FAN_SPEED, UpDownType.UP, UnDefType.UNDEF, UpDownType.UP, StringType.valueOf("UP"));
+    }
+
+    @Test
+    public void testDown() throws RFXComException {
+        testCommand(CHANNEL_FAN_SPEED, UpDownType.DOWN, UnDefType.UNDEF, UpDownType.DOWN, StringType.valueOf("DOWN"));
+    }
+
+    @Test
+    public void testCommandString() throws RFXComException {
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("POWER"), UnDefType.UNDEF, null,
+                StringType.valueOf("POWER"));
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("UP"), UnDefType.UNDEF, UpDownType.UP,
+                StringType.valueOf("UP"));
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("DOWN"), UnDefType.UNDEF, UpDownType.DOWN,
+                StringType.valueOf("DOWN"));
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("LIGHT"), OnOffType.ON, null,
+                StringType.valueOf("LIGHT"));
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("LEARN"), UnDefType.UNDEF, null,
+                StringType.valueOf("LEARN"));
+        testCommand(CHANNEL_COMMAND_STRING, StringType.valueOf("RESET_FILTER"), UnDefType.UNDEF, null,
+                StringType.valueOf("RESET_FILTER"));
+    }
+
+    private void testCommand(String channel, State inputValue, State expectedLightCommand,
+            @Nullable State expectedFanSpeed, State expectedCommandString) throws RFXComException {
+        RFXComFanMessageTest.testCommand(NOVY, channel, inputValue, null, expectedLightCommand, expectedFanSpeed,
+                expectedCommandString, FAN_NOVY);
+    }
+}