From 8b1eabe16634ac435a40214c0491f0a0179112f1 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 31 Oct 2021 12:41:40 +0100 Subject: [PATCH] [miio] sending device in MiIoSendCommand (#11475) * [miio] sending device in MiIoSendCommand Signed-off-by: Marcel Verpaalen * [miio] spotless reformatting Signed-off-by: Marcel Verpaalen --- .../binding/miio/internal/MiIoSendCommand.java | 11 +++++++++-- .../internal/transport/MiIoAsyncCommunication.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoSendCommand.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoSendCommand.java index 4fac814dfcb..b26bd251d11 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoSendCommand.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoSendCommand.java @@ -30,6 +30,7 @@ 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 = ""; @@ -37,17 +38,19 @@ public class MiIoSendCommand { 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() { @@ -102,4 +105,8 @@ public class MiIoSendCommand { public void setCloudServer(String cloudServer) { this.cloudServer = cloudServer; } + + public String getSender() { + return sender; + } } diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/transport/MiIoAsyncCommunication.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/transport/MiIoAsyncCommunication.java index 15c710300bb..1bb9018b4a9 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/transport/MiIoAsyncCommunication.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/transport/MiIoAsyncCommunication.java @@ -148,7 +148,7 @@ public class MiIoAsyncCommunication { 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