Skip to content

Commit

Permalink
#4 inverted logic is only for read only channels
Browse files Browse the repository at this point in the history
  • Loading branch information
magx2 committed Apr 10, 2019
1 parent d946ed2 commit 64eb5a3
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,8 @@ private void handleOneZeroCommand(final int channelId,
final boolean firstOrSecond,
final ChannelFunctionActionEnum first,
final ChannelFunctionActionEnum second) throws ApiException {
final pl.grzeslowski.jsupla.api.generated.model.Channel channel = queryForChannel(channelId);
final boolean invertedLogic = channel.getParam3() != null && channel.getParam3() > 1;
final ChannelFunctionActionEnum action;
if (invertedLogic) {
action = firstOrSecond ? second : first;
} else {
action = firstOrSecond ? first : second;
}
logger.trace("Executing 0/1 command `{}` inverted={}", action, invertedLogic);
final ChannelFunctionActionEnum action = firstOrSecond ? first : second;
logger.trace("Executing 0/1 command `{}`", action);
channelsApi.executeAction(new ChannelExecuteActionRequest().action(action), channelId);
}

Expand Down

0 comments on commit 64eb5a3

Please sign in to comment.