[miio] Fix handling commands with curly brackets (#8897)
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
parent
74ee8e76cf
commit
9a5832a2ee
|
@ -209,9 +209,11 @@ public abstract class MiIoAbstractHandler extends BaseThingHandler implements Mi
|
||||||
try {
|
try {
|
||||||
String command = commandString.trim();
|
String command = commandString.trim();
|
||||||
String param = "[]";
|
String param = "[]";
|
||||||
int loc = command.indexOf("[");
|
int sb = command.indexOf("[");
|
||||||
loc = (loc > 0 ? loc : command.indexOf("{"));
|
int cb = command.indexOf("{");
|
||||||
if (loc > 0) {
|
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();
|
param = command.substring(loc).trim();
|
||||||
command = command.substring(0, loc).trim();
|
command = command.substring(0, loc).trim();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue