Skip to content

Commit

Permalink
[rfxcom] Support for Lucciair DC Speed (openhab#12038)
Browse files Browse the repository at this point in the history
* [rfxcom] Support speed for luca DC version
* [rfxcom] Handle null value for speed
* [rfxcom] Update readme and add migration channel

Signed-off-by: Martin van Wingerden <martin@martinvw.nl>
  • Loading branch information
martinvw authored and psmedley committed Feb 23, 2023
1 parent 31ee665 commit 799d122
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
27 changes: 14 additions & 13 deletions bundles/org.openhab.binding.rfxcom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,13 @@ A Lucci Air DC fan device

##### Channels

| Name | Channel Type | Item Type | Remarks |
|--------------|-------------------------------------|---------------|---------------------------------------------------------------|
| commandString| [commandString](#channels) | String | Options: POWER, UP, DOWN, LIGHT, REVERSE, NATURAL_FLOW, PAIR |
| fanSpeed | [fanspeedcontrol](#channels) | RollerShutter | Options: UP / DOWN |
| fanLight | [fanlight](#channels) | Switch | |
| signalLevel | [system.signal-strength](#channels) | Number | |
| Name | Channel Type | Item Type | Remarks |
|-----------------|-------------------------------------|---------------|--------------------------------------------------------------|
| commandString | [commandString](#channels) | String | Options: POWER, UP, DOWN, LIGHT, REVERSE, NATURAL_FLOW, PAIR |
| fanSpeedControl | [fanspeedcontrol](#channels) | RollerShutter | Options: UP / DOWN |
| fanSpeed | [fanspeed](#channels) | Number | Options: 1,2,3,4,5,6 |
| fanLight | [fanlight](#channels) | Switch | |
| signalLevel | [system.signal-strength](#channels) | Number | |

##### Configuration Options

Expand Down Expand Up @@ -542,13 +543,13 @@ 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 | |
| Name | Channel Type | Item Type | Remarks |
|-----------------|-------------------------------------|---------------|--------------------------|
| command | [command](#channels) | Switch | |
| commandString | [commandString](#channels) | String | Options: POWER, UP, DOWN, LIGHT, LEARN, RESET_FILTER |
| fanSpeedControl | [fanspeedcontrol](#channels) | RollerShutter | Options: UP / DOWN |
| fanLight | [fanlight](#channels) | Switch | |
| signalLevel | [system.signal-strength](#channels) | Number | |

##### Configuration Options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ public enum Commands implements ByteEnumWrapperWithSupportedSubTypes<SubType> {
LUCCI_AIR_DC_REVERSE(5, LUCCI_AIR_DC),
LUCCI_AIR_DC_NATURAL_FLOW(6, LUCCI_AIR_DC),
LUCCI_AIR_DC_PAIR(7, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_1(8, 1, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_2(9, 2, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_3(10, 3, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_4(11, 4, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_5(12, 5, LUCCI_AIR_DC),
LUCCI_AIR_DC_SPEED_6(13, 6, LUCCI_AIR_DC),

LUCCI_AIR_DC_II_POWER_OFF(1, 0, LUCCI_AIR_DC_II),
LUCCI_AIR_DC_II_SPEED_1(2, 1, LUCCI_AIR_DC_II),
Expand Down Expand Up @@ -141,7 +147,7 @@ public enum Commands implements ByteEnumWrapperWithSupportedSubTypes<SubType> {
@Nullable
public static Commands bySpeed(SubType subType, int speed) {
for (Commands value : values()) {
if (value.supportedBySubTypes.contains(subType) && value.speed == speed) {
if (value.supportedBySubTypes.contains(subType) && value.speed != null && value.speed == speed) {
return value;
}
}
Expand Down Expand Up @@ -169,7 +175,9 @@ public List<SubType> supportedBySubTypes() {
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);
LUCCI_AIR_DC_II_SPEED_4, LUCCI_AIR_DC_II_SPEED_5, LUCCI_AIR_DC_II_SPEED_6, LUCCI_AIR_DC_SPEED_1,
LUCCI_AIR_DC_SPEED_2, LUCCI_AIR_DC_SPEED_3, LUCCI_AIR_DC_SPEED_4, LUCCI_AIR_DC_SPEED_5,
LUCCI_AIR_DC_SPEED_6);
private static final List<Commands> OFF_COMMANDS = Arrays.asList(OFF, FALMEC_POWER_OFF, LUCCI_AIR_DC_II_POWER_OFF);

private SubType subType;
Expand Down Expand Up @@ -321,6 +329,12 @@ private State handleFanSpeedChannel() {
case FT1211R_SPEED_3:
case FT1211R_SPEED_4:
case FT1211R_SPEED_5:
case LUCCI_AIR_DC_SPEED_1:
case LUCCI_AIR_DC_SPEED_2:
case LUCCI_AIR_DC_SPEED_3:
case LUCCI_AIR_DC_SPEED_4:
case LUCCI_AIR_DC_SPEED_5:
case LUCCI_AIR_DC_SPEED_6:
case LUCCI_AIR_DC_II_POWER_OFF:
case LUCCI_AIR_DC_II_SPEED_1:
case LUCCI_AIR_DC_II_SPEED_2:
Expand Down Expand Up @@ -460,6 +474,9 @@ private Commands handleFanLightCommand(String channelId, Type type) throws RFXCo

case LUCCI_AIR_DC_II:
return LUCCI_AIR_DC_II_LIGHT;

default:
// return exception
}
} else if (type == OnOffType.OFF && subType == FALMEC) {
return Commands.FALMEC_LIGHT_OFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

<channels>
<channel id="commandString" typeId="commandString"/>
<channel id="fanSpeed" typeId="fanspeedcontrol"/>
<channel id="fanSpeedControl" typeId="fanspeedcontrol"/>
<channel id="fanSpeed" typeId="fanspeed"/>
<channel id="fanLight" typeId="command"/>
<channel id="signalLevel" typeId="system.signal-strength"/>
</channels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

<channels>
<channel id="commandString" typeId="commandString"/>
<channel id="fanSpeedControl" typeId="fanspeedcontrol"/>
<!-- Deprecated fanSpeed should only be used for the numeric channel fanspeed -->
<channel id="fanSpeed" typeId="fanspeedcontrol"/>
<channel id="fanLight" typeId="command"/>
<channel id="signalLevel" typeId="system.signal-strength"/>
Expand Down

0 comments on commit 799d122

Please sign in to comment.