Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OmniLink] Use jomnilink for command numbers #10273

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.omnilink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.github.digitaldan</groupId>
<artifactId>jomnilink</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -97,32 +98,32 @@ 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);
}
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);
}
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);
}
Expand All @@ -149,7 +150,7 @@ private void handlePlayPauseCommand(ChannelUID channelUID, PlayPauseType command
Optional<AudioPlayer> 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 {
Expand All @@ -168,7 +169,7 @@ private void handleNextPreviousCommand(ChannelUID channelUID, NextPreviousType c
Optional<AudioPlayer> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,16 +69,15 @@ 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);
}
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Dimensionless>) 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<Dimensionless>) command).floatValue()),
thingID);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
Loading