[velbus] Add VMB4LEDPWM-20 OnOff command support (#18287)

* [velbus] update README

Signed-off-by: Daniel Rosengarten <github@praetorians.be>
pull/18293/head
Daniel Rosengarten 2025-02-19 08:56:43 +01:00 committed by GitHub
parent eb717083d2
commit 0ccaa3379b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 5 deletions

View File

@ -549,11 +549,11 @@ Thing velbus:vmbdali:1:01 [VL1="CH1,CH2,CH3,CH4", VL2="A4,A5,A6"]
| `clockAlarm` | `clockAlarm1WakeupHour`, `clockAlarm1WakeupMinute`, `clockAlarm1BedtimeHour`, `clockAlarm1BedtimeMinute`, `clockAlarm2WakeupHour`, `clockAlarm2WakeupMinute`, `clockAlarm2BedtimeHour`, `clockAlarm2BedtimeMinute` | Number | |
### Module `vmb4ledpwm-20`
| Supported channels groups | Supported channels | Supported command types | Remarks |
|---------------------------|------------------------|---------------------------------|-------------------|
| `brightness` | `CH1` ... `CH4` | Percent | |
| `fade-mode` | `CH1` ... `CH4` | Direct, Fade_Rate, Fade_Time | |
| `scene` | `CH1` ... `CH4` | Number | Min = 1, Max = 15 |
| Supported channels groups | Supported channels | Supported command types | Remarks |
|---------------------------|------------------------|---------------------------------|----------------------------------------------------------------------------------------------------|
| `brightness` | `CH1` ... `CH4` | OnOff, Percent | Sending an ON command will switch the dimmer to the value stored when last turning the dimmer off. |
| `fade-mode` | `CH1` ... `CH4` | Direct, Fade_Rate, Fade_Time | |
| `scene` | `CH1` ... `CH4` | Number | Min = 1, Max = 15 |
### Module `vmb8dc-20`
| Supported channels groups | Supported channels | Supported command types | Remarks |

View File

@ -29,6 +29,7 @@ import org.openhab.binding.velbus.internal.packets.VelbusPacket;
import org.openhab.binding.velbus.internal.packets.VelbusSetDimPacket;
import org.openhab.binding.velbus.internal.packets.VelbusSetScenePacket;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.PercentType;
import org.openhab.core.library.types.StringType;
import org.openhab.core.thing.ChannelUID;
@ -196,6 +197,16 @@ public class VelbusNewDimmerHandler extends VelbusSensorWithAlarmClockHandler {
packet.setDim(colorChannel.getBrightnessVelbus());
packet.setMode(fadeModeChannels[Byte.toUnsignedInt(channel) - 1]);
velbusBridgeHandler.sendPacket(packet.getBytes());
} else if (command instanceof OnOffType onOffCommand) {
VelbusSetDimPacket packet = new VelbusSetDimPacket(address, channel);
if (onOffCommand == OnOffType.ON) {
packet.setLastUsedDim();
} else {
colorChannel.setBrightness(0);
packet.setDim(colorChannel.getBrightnessVelbus());
}
packet.setMode(fadeModeChannels[Byte.toUnsignedInt(channel) - 1]);
velbusBridgeHandler.sendPacket(packet.getBytes());
} else {
throw new UnsupportedOperationException(
"The command '" + command + "' is not supported on channel '" + channelUID + "'.");

View File

@ -40,6 +40,10 @@ public class VelbusSetDimPacket extends VelbusPacket {
data[3] = mode;
}
public void setLastUsedDim() {
data[0] = COMMAND_RESTORE_LAST_DIMVALUE;
}
@Override
protected byte[] getDataBytes() {
return data;