Skip to content

Commit

Permalink
[miio] also refresh after custom commands (openhab#10714)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored May 26, 2021
1 parent 83c405d commit 2415de2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public void handleCommand(ChannelUID channelUID, Command receivedCommand) {
}
return;
}
if (channelUID.getId().equals(CHANNEL_COMMAND)) {
cmds.put(sendCommand(command.toString()), command.toString());
if (handleCommandsChannels(channelUID, command)) {
forceStatusUpdate();
return;
}
logger.debug("Locating action for {} channel '{}': '{}'", getThing().getUID(), channelUID.getId(), command);
Expand Down Expand Up @@ -263,15 +263,19 @@ public void handleCommand(ChannelUID channelUID, Command receivedCommand) {
}
}
}
updateDataCache.invalidateValue();
miIoScheduler.schedule(() -> {
updateData();
}, 3000, TimeUnit.MILLISECONDS);
forceStatusUpdate();
} else {
logger.debug("Actions not loaded yet, or none available");
}
}

private void forceStatusUpdate() {
updateDataCache.invalidateValue();
miIoScheduler.schedule(() -> {
updateData();
}, 3000, TimeUnit.MILLISECONDS);
}

private @Nullable JsonElement miotTransform(MiIoBasicChannel miIoBasicChannel, @Nullable JsonElement value) {
JsonObject json = new JsonObject();
json.addProperty("did", miIoBasicChannel.getChannel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public void handleCommand(ChannelUID channelUID, Command command) {
return;
}
if (handleCommandsChannels(channelUID, command)) {
forceStatusUpdate();
return;
}
if (channelUID.getId().equals(CHANNEL_VACUUM)) {
Expand Down

0 comments on commit 2415de2

Please sign in to comment.