Closed Dawnes closed 6 years ago
Heres a quick and dirty fix, there's probably a better way to resolve this though.
def parse(String description) {
log.debug "parse()"
def STATUS_PREFIX = "{\"Status";
def RESULT_PREFIX = "{\"POWER";
def message = parseLanMessage(description);
//log.debug("BODY: " + message.body);
if (message?.body?.startsWith(STATUS_PREFIX)) {
//def statusJson = message.body.substring(STATUS_PREFIX.length())
def statusJson = message.body
parseStatus(statusJson);
}
else if (message?.body?.startsWith(RESULT_PREFIX)) {
//def resultJson = message.body.substring(RESULT_PREFIX.length())
def resultJson = message.body
parseResult(resultJson);
}
}
Command STATUS has changed reply in 5.11, which makes the device handler unable to parse the current status of the device (on or off):
New (5.11): {"Status":{"Module":1,"FriendlyName":"Sonoff","Topic":"sonoff","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}
Old (5.10) STATUS = {"Status":{"Module":1,"FriendlyName":"Sonoff","Topic":"sonoff","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}