[rfxcom] Add Novy extractor fans (#10891)

This commit is contained in:
James Hewitt 2021-06-23 17:10:29 +01:00 committed by GitHub
parent 0728e16335
commit 08706f1314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 184 additions and 31 deletions

View 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
@ -539,6 +539,28 @@ A Lucci Air DC II fan device
* 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
An Energy device

View 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);

View 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),

View 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:

View 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);

View File

@ -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>

View 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"));

View File

@ -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);
}
}