From b99da8b596b010027c592e384691b827ea948ac8 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 3 Sep 2021 15:50:42 +0200 Subject: [PATCH] Mi Band 6: really fix weather on new firmware --- .../gadgetbridge/service/devices/huami/HuamiSupport.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index 176f86c25..70fbccf3f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -1448,7 +1448,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { writeToConfiguration(builder,AmazfitBipService.COMMAND_ACK_FIND_PHONE_IN_PROGRESS); builder.queue(getQueue()); } catch (Exception ex) { - LOG.error("Error sending current weather", ex); + LOG.error("Error while ending acknowledge find phone", ex); } } @@ -2819,8 +2819,13 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { protected void writeToChunked(TransactionBuilder builder, int type, byte[] data) { if (force2021Protocol && type > 0) { + boolean encrypt = true; + if (type == 1 && (data[1] == 2)) { // don't encypt current weather + encrypt = false; + } + byte[] command = ArrayUtils.addAll(new byte[]{0x00, 0x00, (byte) (0xc0 | type), 0x00}, data); - writeToChunked2021(builder, HuamiService.CHUNKED2021_ENDPOINT_COMPAT, getNextHandle(), command, type != 1); + writeToChunked2021(builder, HuamiService.CHUNKED2021_ENDPOINT_COMPAT, getNextHandle(), command, encrypt); } else { writeToChunkedOld(builder, type, data); }