[miio] Fix handling commands with curly brackets (#8897)

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
Marcel 2020-10-30 07:24:20 +01:00 committed by GitHub
parent 74ee8e76cf
commit 9a5832a2ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,9 +209,11 @@ public abstract class MiIoAbstractHandler extends BaseThingHandler implements Mi
try {
String command = commandString.trim();
String param = "[]";
int loc = command.indexOf("[");
loc = (loc > 0 ? loc : command.indexOf("{"));
if (loc > 0) {
int sb = command.indexOf("[");
int cb = command.indexOf("{");
logger.debug("locs {}, {}", sb, cb);
if (Math.max(sb, cb) > 0) {
int loc = (Math.min(sb, cb) > 0 ? Math.min(sb, cb) : Math.max(sb, cb));
param = command.substring(loc).trim();
command = command.substring(0, loc).trim();
}