Skip to content

Commit

Permalink
[miio] sending device in MiIoSendCommand (openhab#11475)
Browse files Browse the repository at this point in the history
* [miio] sending device in MiIoSendCommand

Signed-off-by: Marcel Verpaalen <[email protected]>

* [miio] spotless reformatting

Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored and jpg0 committed Nov 10, 2021
1 parent 50a1d05 commit 718fe51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,27 @@ public class MiIoSendCommand {
private final int id;
private final MiIoCommand command;
private final JsonObject commandJson;
private final String sender;
private @Nullable JsonObject response;
private String cloudServer = "";

public void setResponse(JsonObject response) {
this.response = response;
}

public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand) {
public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String sender) {
this.id = id;
this.command = command;
this.commandJson = fullCommand;
this.sender = sender;
}

public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String cloudServer) {
public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String cloudServer, String sender) {
this.id = id;
this.command = command;
this.commandJson = fullCommand;
this.cloudServer = cloudServer;
this.sender = sender;
}

public int getId() {
Expand Down Expand Up @@ -102,4 +105,8 @@ public String getCloudServer() {
public void setCloudServer(String cloudServer) {
this.cloudServer = cloudServer;
}

public String getSender() {
return sender;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public int queueCommand(String command, String params, String cloudServer, Strin
fullCommand.add("params", JsonParser.parseString(params));
}
MiIoSendCommand sendCmd = new MiIoSendCommand(cmdId, MiIoCommand.getCommand(command), fullCommand,
cloudServer);
cloudServer, sender);
concurrentLinkedQueue.add(sendCmd);
if (logger.isDebugEnabled()) {
// Obfuscate part of the token to allow sharing of the logfiles
Expand Down

0 comments on commit 718fe51

Please sign in to comment.