Skip to content

Commit

Permalink
[livisismarthome] Support for restart added (openhab#16968)
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Strohschein <[email protected]>
Signed-off-by: Sven Strohschein <[email protected]>
  • Loading branch information
sstrohschein committed Jun 30, 2024
1 parent eaae6a8 commit 73583f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
import java.net.URI;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -133,7 +129,17 @@ public LivisiBridgeHandler(final Bridge bridge, final OAuthFactory oAuthFactory,

@Override
public void handleCommand(final ChannelUID channelUID, final Command command) {
// not needed
if (CHANNEL_RESTART.equals(channelUID.getId())) {
commandRestart(command);
} else {
logger.debug("UNSUPPORTED channel {} for bridge {}.", channelUID.getId(), bridgeId);
}
}

private void commandRestart(Command command) {
if (command instanceof OnOffType && OnOffType.ON.equals(command)) {
commandRestart();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ private void executeCommand(ChannelUID channelUID, Command command, LivisiBridge
commandSwitchSiren(command, SIREN_NOTIFICATION, bridgeHandler);
} else if (CHANNEL_SIREN_FEEDBACK.equals(channelUID.getId())) {
commandSwitchSiren(command, SIREN_FEEDBACK, bridgeHandler);
} else if (CHANNEL_RESTART.equals(channelUID.getId())) {
commandRestart(command, bridgeHandler);
} else {
logger.debug("UNSUPPORTED channel {} for device {}.", channelUID.getId(), deviceId);
}
Expand Down Expand Up @@ -234,12 +232,6 @@ private void commandSwitchSiren(Command command, String notificationSound, Livis
}
}

private void commandRestart(Command command, LivisiBridgeHandler bridgeHandler) {
if (command instanceof OnOffType && OnOffType.ON.equals(command)) {
bridgeHandler.commandRestart();
}
}

@Override
public void initialize() {
logger.debug("Initializing LIVISI SmartHome device handler.");
Expand Down

0 comments on commit 73583f6

Please sign in to comment.