From 31f4330715d496d7d99e2977e13f77b04277ca84 Mon Sep 17 00:00:00 2001 From: Ethan Dye Date: Wed, 3 Mar 2021 15:04:38 -0700 Subject: [PATCH] [OmniLink] Use jomnilink for command numbers (#10273) Signed-off-by: Ethan Dye --- bundles/org.openhab.binding.omnilink/pom.xml | 2 +- .../internal/handler/AudioZoneHandler.java | 17 +- .../internal/handler/ButtonHandler.java | 3 +- .../internal/handler/ConsoleHandler.java | 7 +- .../handler/HumiditySensorHandler.java | 5 +- .../internal/handler/LockHandler.java | 5 +- .../internal/handler/LuminaAreaHandler.java | 14 +- .../internal/handler/OmniAreaHandler.java | 16 +- .../internal/handler/OmniLinkCmd.java | 199 ------------------ .../handler/OmnilinkBridgeHandler.java | 6 +- .../internal/handler/TempSensorHandler.java | 5 +- .../internal/handler/ThermostatHandler.java | 19 +- .../internal/handler/UnitHandler.java | 8 +- .../internal/handler/ZoneHandler.java | 5 +- .../handler/units/DimmableUnitHandler.java | 11 +- .../internal/handler/units/FlagHandler.java | 6 +- .../handler/units/UpbRoomHandler.java | 12 +- .../units/dimmable/UpbUnitHandler.java | 5 +- 18 files changed, 79 insertions(+), 266 deletions(-) delete mode 100644 bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniLinkCmd.java diff --git a/bundles/org.openhab.binding.omnilink/pom.xml b/bundles/org.openhab.binding.omnilink/pom.xml index 07e400f6ccd16..7b68c65c9417f 100644 --- a/bundles/org.openhab.binding.omnilink/pom.xml +++ b/bundles/org.openhab.binding.omnilink/pom.xml @@ -18,7 +18,7 @@ com.github.digitaldan jomnilink - 1.4.1 + 1.4.2 compile diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/AudioZoneHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/AudioZoneHandler.java index c3e4f4d11346f..f80e28da5a988 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/AudioZoneHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/AudioZoneHandler.java @@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AudioZoneProperties; import com.digitaldan.jomnilinkII.MessageTypes.statuses.ExtendedAudioZoneStatus; @@ -97,7 +98,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_AUDIO_ZONE_POWER: if (command instanceof OnOffType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_ON_MUTE.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_ON_AND_MUTE, OnOffType.OFF.equals(command) ? 0 : 1, thingID); } else { logger.debug("Invalid command: {}, must be OnOffType", command); @@ -105,7 +106,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { break; case CHANNEL_AUDIO_ZONE_MUTE: if (command instanceof OnOffType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_ON_MUTE.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_ON_AND_MUTE, OnOffType.OFF.equals(command) ? 2 : 3, thingID); } else { logger.debug("Invalid command: {}, must be OnOffType", command); @@ -113,16 +114,16 @@ public void handleCommand(ChannelUID channelUID, Command command) { break; case CHANNEL_AUDIO_ZONE_VOLUME: if (command instanceof PercentType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_VOLUME.getNumber(), - ((PercentType) command).intValue(), thingID); + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_VOLUME, ((PercentType) command).intValue(), + thingID); } else { logger.debug("Invalid command: {}, must be PercentType", command); } break; case CHANNEL_AUDIO_ZONE_SOURCE: if (command instanceof DecimalType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_SOURCE.getNumber(), - ((DecimalType) command).intValue(), thingID); + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_SOURCE, ((DecimalType) command).intValue(), + thingID); } else { logger.debug("Invalid command: {}, must be DecimalType", command); } @@ -149,7 +150,7 @@ private void handlePlayPauseCommand(ChannelUID channelUID, PlayPauseType command Optional audioPlayer = bridgeHandler.getAudioPlayer(); if (audioPlayer.isPresent()) { AudioPlayer player = audioPlayer.get(); - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_SOURCE.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_SOURCE, PlayPauseType.PLAY.equals(command) ? player.getPlayCommand() : player.getPauseCommand(), thingID); } else { @@ -168,7 +169,7 @@ private void handleNextPreviousCommand(ChannelUID channelUID, NextPreviousType c Optional audioPlayer = bridgeHandler.getAudioPlayer(); if (audioPlayer.isPresent()) { AudioPlayer player = audioPlayer.get(); - sendOmnilinkCommand(OmniLinkCmd.CMD_AUDIO_ZONE_SET_SOURCE.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_AUDIO_ZONE_SET_SOURCE, NextPreviousType.NEXT.equals(command) ? player.getNextCommand() : player.getPreviousCommand(), thingID); } else { diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ButtonHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ButtonHandler.java index a288fa00a88f4..64e47498bd31c 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ButtonHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ButtonHandler.java @@ -31,6 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; import com.digitaldan.jomnilinkII.MessageTypes.properties.ButtonProperties; @@ -97,7 +98,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_BUTTON_PRESS: if (command instanceof OnOffType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_BUTTON.getNumber(), 0, thingID); + sendOmnilinkCommand(CommandMessage.CMD_BUTTON, 0, thingID); updateChannels(); } else { logger.debug("Invalid command: {}, must be OnOffType", command); diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ConsoleHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ConsoleHandler.java index 70340edb48bac..0afb46af4173f 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ConsoleHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ConsoleHandler.java @@ -27,6 +27,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; + /** * The {@link ConsoleHandler} defines some methods that are used to * interface with an OmniLink Console. This by extension also defines the @@ -67,7 +69,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_CONSOLE_ENABLE_DISABLE_BEEPER: if (command instanceof StringType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_CONSOLE_ENABLE_DISABLE_BEEPER.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_CONSOLE_ENABLE_DISABLE_BEEPER, ((StringType) command).equals(StringType.valueOf("OFF")) ? 0 : 1, thingID); } else { logger.debug("Invalid command: {}, must be StringType", command); @@ -75,8 +77,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { break; case CHANNEL_CONSOLE_BEEP: if (command instanceof DecimalType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_CONSOLE_BEEP.getNumber(), ((DecimalType) command).intValue(), - thingID); + sendOmnilinkCommand(CommandMessage.CMD_CONSOLE_BEEP, ((DecimalType) command).intValue(), thingID); } else { logger.debug("Invalid command: {}, must be DecimalType", command); } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/HumiditySensorHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/HumiditySensorHandler.java index a0751d68b7fa3..002c4dcc8f1fb 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/HumiditySensorHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/HumiditySensorHandler.java @@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; import com.digitaldan.jomnilinkII.MessageTypes.properties.AuxSensorProperties; @@ -112,12 +113,12 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_AUX_LOW_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_HEAT_POINT, TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType) command).floatValue()), thingID); break; case CHANNEL_AUX_HIGH_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_COOL_POINT, TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType) command).floatValue()), thingID); break; diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LockHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LockHandler.java index 7c7ceed68e529..b2e554c525e4b 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LockHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LockHandler.java @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AccessControlReaderProperties; import com.digitaldan.jomnilinkII.MessageTypes.statuses.ExtendedAccessControlReaderLockStatus; @@ -92,8 +93,8 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_LOCK_SWITCH: if (command instanceof OnOffType) { - sendOmnilinkCommand(OnOffType.OFF.equals(command) ? OmniLinkCmd.CMD_UNLOCK_DOOR.getNumber() - : OmniLinkCmd.CMD_LOCK_DOOR.getNumber(), 0, thingID); + sendOmnilinkCommand(OnOffType.OFF.equals(command) ? CommandMessage.CMD_UNLOCK_DOOR + : CommandMessage.CMD_LOCK_DOOR, 0, thingID); } else { logger.debug("Invalid command {}, must be OnOffType", command); } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LuminaAreaHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LuminaAreaHandler.java index e560e0939e435..b7a626ddc5c2e 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LuminaAreaHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/LuminaAreaHandler.java @@ -23,6 +23,8 @@ import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; + /** * The {@link LuminaAreaHandler} defines some methods that are used to * interface with an OmniLink Lumina Area. This by extension also defines the @@ -44,17 +46,17 @@ public LuminaAreaHandler(Thing thing) { protected int getMode(ChannelUID channelUID) { switch (channelUID.getId()) { case CHANNEL_AREA_SECURITY_MODE_HOME: - return OmniLinkCmd.CMD_SECURITY_LUMINA_HOME_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_HOME_MODE; case CHANNEL_AREA_SECURITY_MODE_SLEEP: - return OmniLinkCmd.CMD_SECURITY_LUMINA_SLEEP_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_SLEEP_MODE; case CHANNEL_AREA_SECURITY_MODE_AWAY: - return OmniLinkCmd.CMD_SECURITY_LUMINA_AWAY_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_AWAY_MODE; case CHANNEL_AREA_SECURITY_MODE_VACATION: - return OmniLinkCmd.CMD_SECURITY_LUMINA_VACATION_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_VACATION_MODE; case CHANNEL_AREA_SECURITY_MODE_PARTY: - return OmniLinkCmd.CMD_SECURITY_LUMINA_PARTY_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_PARTY_MODE; case CHANNEL_AREA_SECURITY_MODE_SPECIAL: - return OmniLinkCmd.CMD_SECURITY_LUMINA_SPECIAL_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_LUMINA_SPECIAL_MODE; default: throw new IllegalStateException("Unknown channel for area thing " + channelUID); } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniAreaHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniAreaHandler.java index 7424d8d981e20..e16a198b17874 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniAreaHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniAreaHandler.java @@ -23,6 +23,8 @@ import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; + /** * The {@link OmniAreaHandler} defines some methods that are used to * interface with an OmniLink OmniPro Area. This by extension also defines the @@ -45,19 +47,19 @@ public OmniAreaHandler(Thing thing) { protected int getMode(ChannelUID channelUID) { switch (channelUID.getId()) { case CHANNEL_AREA_SECURITY_MODE_DISARM: - return OmniLinkCmd.CMD_SECURITY_OMNI_DISARM.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_DISARM; case CHANNEL_AREA_SECURITY_MODE_DAY: - return OmniLinkCmd.CMD_SECURITY_OMNI_DAY_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_DAY_MODE; case CHANNEL_AREA_SECURITY_MODE_NIGHT: - return OmniLinkCmd.CMD_SECURITY_OMNI_NIGHT_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_NIGHT_MODE; case CHANNEL_AREA_SECURITY_MODE_AWAY: - return OmniLinkCmd.CMD_SECURITY_OMNI_AWAY_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_AWAY_MODE; case CHANNEL_AREA_SECURITY_MODE_VACATION: - return OmniLinkCmd.CMD_SECURITY_OMNI_VACATION_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_VACATION_MODE; case CHANNEL_AREA_SECURITY_MODE_DAY_INSTANT: - return OmniLinkCmd.CMD_SECURITY_OMNI_DAY_INSTANCE_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_DAY_INSTANT_MODE; case CHANNEL_AREA_SECURITY_MODE_NIGHT_DELAYED: - return OmniLinkCmd.CMD_SECURITY_OMNI_NIGHT_DELAYED_MODE.getNumber(); + return CommandMessage.CMD_SECURITY_OMNI_NIGHT_DELAYED_MODE; default: throw new IllegalStateException("Unknown channel for area thing " + channelUID); } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniLinkCmd.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniLinkCmd.java deleted file mode 100644 index 20e3f7cba1fe0..0000000000000 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmniLinkCmd.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * 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.omnilink.internal.handler; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * OmniLink commands - * - * @author Dan Cunningham - Initial contribution - * @author Ethan Dye - openHAB3 rewrite - * @since 1.5.0 - */ -@NonNullByDefault -public enum OmniLinkCmd { - CMD_UNIT_OFF(0), - CMD_UNIT_ON(1), - CMD_UNIT_AREA_ALL_OFF(2), - CMD_UNIT_AREA_ALL_ON(3), - CMD_UNIT_PERCENT(9), - CMD_UNIT_LO9_LEVEL_HIGH7(101), - CMD_UNIT_DECREMENT_COUNTER(10), - CMD_UNIT_INCREMENT_COUNTER(11), - CMD_UNIT_SET_COUNTER(12), - CMD_UNIT_LO9_RAMP_HIGH7(13), - CMD_UNIT_LIGHTOLIER(14), - CMD_UNIT_UPB_REQ_STATUS(15), - CMD_UNIT_UNIT_DIM_STEP_1(17), - CMD_UNIT_UNIT_DIM_STEP_2(18), - CMD_UNIT_UNIT_DIM_STEP_3(19), - CMD_UNIT_UNIT_DIM_STEP_4(20), - CMD_UNIT_UNIT_DIM_STEP_5(21), - CMD_UNIT_UNIT_DIM_STEP_6(22), - CMD_UNIT_UNIT_DIM_STEP_7(23), - CMD_UNIT_UNIT_DIM_STEP_8(24), - CMD_UNIT_UNIT_DIM_STEP_9(25), - CMD_UNIT_UNIT_BRIGHTEN_STEP_1(33), - CMD_UNIT_UNIT_BRIGHTEN_STEP_2(34), - CMD_UNIT_UNIT_BRIGHTEN_STEP_3(35), - CMD_UNIT_UNIT_BRIGHTEN_STEP_4(36), - CMD_UNIT_UNIT_BRIGHTEN_STEP_5(37), - CMD_UNIT_UNIT_BRIGHTEN_STEP_6(38), - CMD_UNIT_UNIT_BRIGHTEN_STEP_7(39), - CMD_UNIT_UNIT_BRIGHTEN_STEP_8(40), - CMD_UNIT_UNIT_BRIGHTEN_STEP_9(41), - CMD_UNIT_UPB_LO9_BLINK_HIGH7(26), - CMD_UNIT_UPB_STOP_BLINK(27), - CMD_UNIT_UPB_LINK_OFF(28), - CMD_UNIT_UPB_LINK_ON(29), - CMD_UNIT_UPB_LINK_SET(30), - CMD_UNIT_CENTRALITE_SCENE_OFF(42), - CMD_UNIT_CENTRALITE_SCENE_ON(43), - CMD_UNIT_UPB_LED_OFF(44), - CMD_UNIT_UPB_LED_ON(45), - CMD_UNIT_RADIORA_PHANTOM_BUTTON_OFF(46), - CMD_UNIT_RADIORA_PHANTM_BUTTON_ON(46), - CMD_UNIT_LEVITON_SCENE_OFF(60), - CMD_UNIT_LEVITON_SCENE_ON(61), - CMD_UNIT_LEVITON_SCENE_SET(62), - - CMD_SECURITY_OMNI_DISARM(48), - CMD_SECURITY_OMNI_DAY_MODE(49), - CMD_SECURITY_OMNI_NIGHT_MODE(50), - CMD_SECURITY_OMNI_AWAY_MODE(51), - CMD_SECURITY_OMNI_VACATION_MODE(52), - CMD_SECURITY_OMNI_DAY_INSTANCE_MODE(53), - CMD_SECURITY_OMNI_NIGHT_DELAYED_MODE(54), - CMD_SECURITY_BYPASS_ZONE(4), - CMD_SECURITY_RESTORE_ZONE(5), - CMD_SECURITY_RESTORE_ALL_ZONES(6), - CMD_SECURITY_LUMINA_HOME_MODE(49), - CMD_SECURITY_LUMINA_SLEEP_MODE(50), - CMD_SECURITY_LUMINA_AWAY_MODE(51), - CMD_SECURITY_LUMINA_VACATION_MODE(52), - CMD_SECURITY_LUMINA_PARTY_MODE(53), - CMD_SECURITY_LUMINA_SPECIAL_MODE(54), - - CMD_BUTTON(7), - - CMD_ENERGY_SAVER_OFF(64), - CMD_ENERGY_SAVER_ON(65), - - CMD_THERMO_SET_HEAT_LOW_POINT(66), - CMD_THERMO_SET_COOL_HIGH_POINT(67), - CMD_THERMO_SET_SYSTEM_MODE(68), - CMD_THERMO_SET_FAN_MODE(69), - CMD_THERMO_SET_HOLD_MODE(70), - CMD_THERMO_RAISE_LOWER_HEAT(71), - CMD_THERMO_RAISE_LOWER_COOL(72), - CMD_THERMO_SET_HUMDIFY_POINT(73), - CMD_THERMO_SET_DEHUMIDIFY_POINT(74), - - CMD_MESSAGE_SHOW_MESSAGE_WITH_BEEP_AND_LED(80), - CMD_MESSAGE_SHOW_MESSAGE_WITH_BEEP_OR_LED(86), - CMD_MESSAGE_LOG_MESSAGE(81), - CMD_MESSAGE_CLEAR_MESSAGE(82), - CMD_MESSAGE_SAY_MESSAGE(83), - CMD_MESSAGE_PHONE_AND_SAY_MESSAGE(84), - CMD_MESSAGE_SEND_MESSAGE_TO_SERIAL_PORT(85), - - CMD_CONSOLE_ENABLE_DISABLE_BEEPER(102), - CMD_CONSOLE_BEEP(103), - - CMD_LOCK_DOOR(105), - CMD_UNLOCK_DOOR(106), - - CMD_AUDIO_ZONE_SET_ON_MUTE(112), - CMD_AUDIO_ZONE_SET_VOLUME(113), - CMD_AUDIO_ZONE_SET_SOURCE(114), - CMD_AUDIO_ZONE_SELECT_KEY(115), - - SENSOR_UNIT_POWER(1001), - SENSOR_UNIT_LEVEL(1002), - SENSOR_UNIT_DISPLAY(1003), - SENSOR_THERMO_HEAT_POINTC(2001), - SENSOR_THERMO_HEAT_POINTF(2002), - SENSOR_THERMO_COOL_POINTC(2003), - SENSOR_THERMO_COOL_POINTF(2004), - SENSOR_THERMO_SYSTEM_MODE(2005), - SENSOR_THERMO_FAN_MODE(2006), - SENSOR_THERMO_HOLD_MODE(2007), - SENSOR_THERMO_TEMPC(2006), - SENSOR_THERMO_TEMPF(2007), - SENSOR_ZONE_STATUS_CURRENT(3001), - SENSOR_ZONE_STATUS_LATCHED(3002), - SENSOR_ZONE_STATUS_ARMING(3003), - SENSOR_AREA_STATUS_MODE(4001), - SENSOR_AREA_STATUS_ALARM(4002), - SENSOR_AREA_STATUS_EXIT_DELAY(4003), - SENSOR_AREA_STATUS_ENTRY_DELAY(4003), - SENSOR_AREA_EXIT_TIMER(4004), - SENSOR_AREA_ENTRY_TIMER(4005), - SENSOR_AUX_STATUS(5001), - SENSOR_AUX_CURRENTC(5002), - SENSOR_AUX_CURRENTF(5003), - SENSOR_AUX_LOWC(5004), - SENSOR_AUX_LOWF(5005), - SENSOR_AUX_HIGHC(5006), - SENSOR_AUX_HIGHF(5007), - SENSOR_AUDIOZONE_POWER(6001), - SENSOR_AUDIOZONE_SOURCE(6002), - SENSOR_AUDIOZONE_VOLUME(6003), - SENSOR_AUDIOZONE_MUTE(6004), - SENSOR_AUDIOZONE_TEXT(6005), - SENSOR_AUDIOZONE_TEXT_FIELD1(6006), - SENSOR_AUDIOZONE_TEXT_FIELD2(6007), - SENSOR_AUDIOZONE_TEXT_FIELD3(6008), - SENSOR_AUDIOSOURCE_TEXT(7001), - SENSOR_AUDIOSOURCE_TEXT_FIELD1(7002), - SENSOR_AUDIOSOURCE_TEXT_FIELD2(7003), - SENSOR_AUDIOSOURCE_TEXT_FIELD3(7004); - - private int number; - - OmniLinkCmd(int number) { - this.number = number; - } - - public int getNumber() { - return number; - } - - public static @Nullable OmniLinkCmd getCommand(String name) { - for (OmniLinkCmd command : OmniLinkCmd.values()) { - if (name.equals(command.toString())) { - return command; - } - } - return null; - } - - public static @Nullable OmniLinkCmd getCommand(int ordinal) { - OmniLinkCmd[] values = OmniLinkCmd.values(); - if (ordinal < values.length) { - return values[ordinal]; - } else { - return null; - } - } - - public static String toList() { - StringBuilder sb = new StringBuilder(); - for (OmniLinkCmd command : OmniLinkCmd.values()) { - sb.append(command.toString()).append(","); - } - return sb.toString(); - } -} diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmnilinkBridgeHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmnilinkBridgeHandler.java index 52232bab26e03..c02dadaa0d84e 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmnilinkBridgeHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/OmnilinkBridgeHandler.java @@ -50,6 +50,7 @@ import com.digitaldan.jomnilinkII.Connection; import com.digitaldan.jomnilinkII.DisconnectListener; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.EventLogData; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.SecurityCodeValidation; @@ -194,7 +195,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { case CHANNEL_CONSOLE_ENABLE_DISABLE_BEEPER: if (command instanceof StringType) { try { - sendOmnilinkCommand(OmniLinkCmd.CMD_CONSOLE_ENABLE_DISABLE_BEEPER.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_CONSOLE_ENABLE_DISABLE_BEEPER, ((StringType) command).equals(StringType.valueOf("OFF")) ? 0 : 1, 0); updateState(CHANNEL_CONSOLE_ENABLE_DISABLE_BEEPER, UnDefType.UNDEF); } catch (NumberFormatException | OmniInvalidResponseException | OmniUnknownMessageTypeException @@ -208,8 +209,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { case CHANNEL_CONSOLE_BEEP: if (command instanceof DecimalType) { try { - sendOmnilinkCommand(OmniLinkCmd.CMD_CONSOLE_BEEP.getNumber(), - ((DecimalType) command).intValue(), 0); + sendOmnilinkCommand(CommandMessage.CMD_CONSOLE_BEEP, ((DecimalType) command).intValue(), 0); updateState(CHANNEL_CONSOLE_BEEP, UnDefType.UNDEF); } catch (NumberFormatException | OmniInvalidResponseException | OmniUnknownMessageTypeException | BridgeOfflineException e) { diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/TempSensorHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/TempSensorHandler.java index 7152841ae0076..75152c27f1a1c 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/TempSensorHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/TempSensorHandler.java @@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; import com.digitaldan.jomnilinkII.MessageTypes.properties.AuxSensorProperties; @@ -125,12 +126,12 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_AUX_LOW_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_HEAT_POINT, temperatureFormat.get().formatToOmni(((QuantityType) command).floatValue()), thingID); break; case CHANNEL_AUX_HIGH_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_COOL_POINT, temperatureFormat.get().formatToOmni(((QuantityType) command).floatValue()), thingID); break; diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ThermostatHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ThermostatHandler.java index f5daccab31857..a66259caf663e 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ThermostatHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ThermostatHandler.java @@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; import com.digitaldan.jomnilinkII.MessageTypes.properties.ThermostatProperties; @@ -144,34 +145,34 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_THERMO_SYSTEM_MODE: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_SYSTEM_MODE.getNumber(), - ((DecimalType) command).intValue(), thingID); + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_SYSTEM_MODE, ((DecimalType) command).intValue(), + thingID); break; case CHANNEL_THERMO_FAN_MODE: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_FAN_MODE.getNumber(), ((DecimalType) command).intValue(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_FAN_MODE, ((DecimalType) command).intValue(), thingID); break; case CHANNEL_THERMO_HOLD_STATUS: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HOLD_MODE.getNumber(), - ((DecimalType) command).intValue(), thingID); + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_HOLD_MODE, ((DecimalType) command).intValue(), + thingID); break; case CHANNEL_THERMO_HEAT_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HEAT_LOW_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_HEAT_POINT, temperatureFormat.get().formatToOmni(((QuantityType) command).floatValue()), thingID); break; case CHANNEL_THERMO_COOL_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_COOL_HIGH_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_COOL_POINT, temperatureFormat.get().formatToOmni(((QuantityType) command).floatValue()), thingID); break; case CHANNEL_THERMO_HUMIDIFY_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_HUMDIFY_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_HUMDIFY_POINT, TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType) command).floatValue()), thingID); break; case CHANNEL_THERMO_DEHUMIDIFY_SETPOINT: - sendOmnilinkCommand(OmniLinkCmd.CMD_THERMO_SET_DEHUMIDIFY_POINT.getNumber(), + sendOmnilinkCommand(CommandMessage.CMD_THERMO_SET_DEHUMIDIFY_POINT, TemperatureFormat.FAHRENHEIT.formatToOmni(((QuantityType) command).floatValue()), thingID); break; diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/UnitHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/UnitHandler.java index 95951b748c769..992905118c73e 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/UnitHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/UnitHandler.java @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; @@ -144,15 +145,14 @@ private void handleUnitDuration(ChannelUID channelUID, DecimalType command) { return; } - sendOmnilinkCommand( - channelID.startsWith("on") ? OmniLinkCmd.CMD_UNIT_ON.getNumber() : OmniLinkCmd.CMD_UNIT_OFF.getNumber(), + sendOmnilinkCommand(channelID.startsWith("on") ? CommandMessage.CMD_UNIT_ON : CommandMessage.CMD_UNIT_OFF, duration, thingID); } protected void handleOnOff(ChannelUID channelUID, OnOffType command) { logger.debug("handleOnOff called for channel: {}, command: {}", channelUID, command); - sendOmnilinkCommand(OnOffType.ON.equals(command) ? OmniLinkCmd.CMD_UNIT_ON.getNumber() - : OmniLinkCmd.CMD_UNIT_OFF.getNumber(), 0, thingID); + sendOmnilinkCommand(OnOffType.ON.equals(command) ? CommandMessage.CMD_UNIT_ON : CommandMessage.CMD_UNIT_OFF, 0, + thingID); } @Override diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ZoneHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ZoneHandler.java index ce8b216e15909..1637049b310eb 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ZoneHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/ZoneHandler.java @@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory; import com.digitaldan.jomnilinkII.Message; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.ObjectStatus; import com.digitaldan.jomnilinkII.MessageTypes.SecurityCodeValidation; import com.digitaldan.jomnilinkII.MessageTypes.properties.AreaProperties; @@ -115,10 +116,10 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_ZONE_BYPASS: - mode = OmniLinkCmd.CMD_SECURITY_BYPASS_ZONE.getNumber(); + mode = CommandMessage.CMD_SECURITY_BYPASS_ZONE; break; case CHANNEL_ZONE_RESTORE: - mode = OmniLinkCmd.CMD_SECURITY_RESTORE_ZONE.getNumber(); + mode = CommandMessage.CMD_SECURITY_RESTORE_ZONE; break; default: mode = -1; diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/DimmableUnitHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/DimmableUnitHandler.java index 632197f0852fd..c4a6ecdbc6cc7 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/DimmableUnitHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/DimmableUnitHandler.java @@ -16,7 +16,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.omnilink.internal.handler.OmniLinkCmd; import org.openhab.binding.omnilink.internal.handler.UnitHandler; import org.openhab.core.library.types.IncreaseDecreaseType; import org.openhab.core.library.types.OnOffType; @@ -27,6 +26,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; + /** * The {@link DimmableUnitHandler} defines some methods that are used to * interface with an OmniLink Dimmable Unit. This by extension also defines the @@ -79,15 +80,13 @@ private void handlePercent(ChannelUID channelUID, PercentType command) { } else if (lightLevel == 100) { super.handleOnOff(channelUID, OnOffType.ON); } else { - sendOmnilinkCommand(OmniLinkCmd.CMD_UNIT_PERCENT.getNumber(), lightLevel, thingID); + sendOmnilinkCommand(CommandMessage.CMD_UNIT_PERCENT, lightLevel, thingID); } } private void handleIncreaseDecrease(ChannelUID channelUID, IncreaseDecreaseType command) { logger.debug("handleIncreaseDecrease called for channel: {}, command: {}", channelUID, command); - sendOmnilinkCommand( - IncreaseDecreaseType.INCREASE.equals(command) ? OmniLinkCmd.CMD_UNIT_UNIT_BRIGHTEN_STEP_1.getNumber() - : OmniLinkCmd.CMD_UNIT_UNIT_DIM_STEP_1.getNumber(), - 0, thingID); + sendOmnilinkCommand(IncreaseDecreaseType.INCREASE.equals(command) ? CommandMessage.CMD_UNIT_UPB_BRIGHTEN_STEP_1 + : CommandMessage.CMD_UNIT_UPB_DIM_STEP_1, 0, thingID); } } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/FlagHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/FlagHandler.java index 67e5083a99091..87b8199035027 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/FlagHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/FlagHandler.java @@ -16,7 +16,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.omnilink.internal.handler.OmniLinkCmd; import org.openhab.binding.omnilink.internal.handler.UnitHandler; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; @@ -29,6 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.statuses.ExtendedUnitStatus; /** @@ -62,8 +62,8 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_FLAG_VALUE: if (command instanceof DecimalType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_UNIT_SET_COUNTER.getNumber(), - ((DecimalType) command).intValue(), thingID); + sendOmnilinkCommand(CommandMessage.CMD_UNIT_SET_COUNTER, ((DecimalType) command).intValue(), + thingID); } else { logger.debug("Invalid command: {}, must be DecimalType", command); } diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/UpbRoomHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/UpbRoomHandler.java index 047b1cf209c58..e92458527fa88 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/UpbRoomHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/UpbRoomHandler.java @@ -16,7 +16,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.omnilink.internal.handler.OmniLinkCmd; import org.openhab.binding.omnilink.internal.handler.UnitHandler; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; @@ -29,6 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; import com.digitaldan.jomnilinkII.MessageTypes.statuses.ExtendedUnitStatus; /** @@ -113,8 +113,8 @@ private void handleRoomScene(ChannelUID channelUID, OnOffType command) { } int roomNum = (thingID + 7) / 8; int param2 = ((roomNum * 6) - 3) + linkNum; - sendOmnilinkCommand(OnOffType.ON.equals(command) ? OmniLinkCmd.CMD_UNIT_UPB_LINK_ON.getNumber() - : OmniLinkCmd.CMD_UNIT_UPB_LINK_OFF.getNumber(), 0, param2); + sendOmnilinkCommand(OnOffType.ON.equals(command) ? CommandMessage.CMD_UNIT_UPB_LINK_ON + : CommandMessage.CMD_UNIT_UPB_LINK_OFF, 0, param2); } private void handleRoomState(ChannelUID channelUID, DecimalType command) { @@ -125,18 +125,18 @@ private void handleRoomState(ChannelUID channelUID, DecimalType command) { switch (cmdValue) { case 0: - cmd = OmniLinkCmd.CMD_UNIT_OFF.getNumber(); + cmd = CommandMessage.CMD_UNIT_OFF; param2 = thingID; break; case 1: - cmd = OmniLinkCmd.CMD_UNIT_ON.getNumber(); + cmd = CommandMessage.CMD_UNIT_ON; param2 = thingID; break; case 2: case 3: case 4: case 5: - cmd = OmniLinkCmd.CMD_UNIT_UPB_LINK_ON.getNumber(); + cmd = CommandMessage.CMD_UNIT_UPB_LINK_ON; /* * A little magic with the link #'s: 0 and 1 are off and on, respectively. * So A ends up being 2, but OmniLink Protocol expects an offset of 0. That diff --git a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/dimmable/UpbUnitHandler.java b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/dimmable/UpbUnitHandler.java index 2fda1ced90bcb..c128b12cec3ca 100644 --- a/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/dimmable/UpbUnitHandler.java +++ b/bundles/org.openhab.binding.omnilink/src/main/java/org/openhab/binding/omnilink/internal/handler/units/dimmable/UpbUnitHandler.java @@ -16,7 +16,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.binding.omnilink.internal.handler.OmniLinkCmd; import org.openhab.binding.omnilink.internal.handler.units.DimmableUnitHandler; import org.openhab.core.library.types.StringType; import org.openhab.core.thing.ChannelUID; @@ -27,6 +26,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.digitaldan.jomnilinkII.MessageTypes.CommandMessage; + /** * The {@link UpbUnitHandler} defines some methods that are used to * interface with an OmniLink UPB Unit. This by extension also defines the @@ -57,7 +58,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { switch (channelUID.getId()) { case CHANNEL_UPB_STATUS: if (command instanceof StringType) { - sendOmnilinkCommand(OmniLinkCmd.CMD_UNIT_UPB_REQ_STATUS.getNumber(), 0, thingID); + sendOmnilinkCommand(CommandMessage.CMD_UNIT_UPB_REQ_STATUS, 0, thingID); updateState(CHANNEL_UPB_STATUS, UnDefType.UNDEF); } else { logger.debug("Invalid command: {}, must be StringType", command);