diff --git a/README.md b/README.md
index ce2c148a3..aa9980a6e 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ vendor's servers.
**(WARNING: Some of them WIP and some of them without maintainer)**
- Amazfit
+ - [Balance](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Balance) [**\[!\]**](#special-pairing-procedures)
- [Band 5](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Band-5), [Band 7](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Band-7) [**\[!\]**](#special-pairing-procedures)
- [Bip](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Bip)
- [Bip Lite](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Bip-Lite), [Bip S](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Bip-S), [Bip U, Bip U Pro](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Bip-U) [**\[!\]**](#special-pairing-procedures)
@@ -44,8 +45,8 @@ vendor's servers.
- [Falcon (experimental)](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Falcon) [**\[!\]**](#special-pairing-procedures)
- [GTR](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR), [GTR 2/2e](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR), [GTR 3](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR-3), [GTR 3 Pro](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR-3-Pro), [GTR 4](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR-4) [**\[!\]**](#special-pairing-procedures)
- [GTR Mini](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTR-Mini) [**\[!\]**](#special-pairing-procedures)
- - [GTS](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS), [GTS 2/2e](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS), [GTS 3](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-3), [GTS 4](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-4), [GTS 4 Mini](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-4-Mini) [**\[!\]**](#special-pairing-procedures)
- - [Neo](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Neo) [**\[!\]**](#special-pairing-procedures)
+ - [GTS](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS), [GTS 2/2e](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS), [GTS 3](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-3), [GTS 4](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-4), [GTS 4 Mini](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-GTS-4-Mini) [**\[!\]**](#special-pairing-procedures)
+ - [Neo](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Neo) [**\[!\]**](#special-pairing-procedures)
- T-Rex, T-Rex Pro, [T-Rex 2](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-T-Rex-2) [**\[!\]**](#special-pairing-procedures)
- [T-Rex Ultra (experimental)](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-T-Rex-Ultra) [**\[!\]**](#special-pairing-procedures)
- [Cheetah (Round/Square) (experimental)](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Amazfit-Cheetah) [**\[!\]**](#special-pairing-procedures)
@@ -120,7 +121,7 @@ vendor's servers.
- [Shell Racing cars](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/SuperCars) (BLE RC car models)
- [Flipper Zero](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Flipper-Zero) (Multi-tool Device for Geeks)
- VESC (BLDC controller VESC)
-- UM25 (USB Voltage meter)
+- UM25 (USB Voltage meter)
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
index 11e52af60..6845c8b13 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
@@ -52,6 +52,7 @@ public class HuamiConst {
public static final String MI_BAND4_NAME = "Mi Smart Band 4";
public static final String MI_BAND5_NAME = "Mi Smart Band 5";
public static final String MI_BAND6_NAME = "Mi Smart Band 6";
+ public static final String AMAZFIT_BALANCE_NAME = "Amazfit Balance";
public static final String AMAZFIT_BAND5_NAME = "Amazfit Band 5";
public static final String AMAZFIT_BAND7_NAME = "Amazfit Band 7";
public static final String AMAZFIT_NEO_NAME = "Amazfit Neo";
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceCoordinator.java
new file mode 100644
index 000000000..fdfe72317
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceCoordinator.java
@@ -0,0 +1,99 @@
+/* Copyright (C) 2023 José Rebelo, Maxime Reyrolle
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
+
+import android.content.Context;
+import android.net.Uri;
+
+import androidx.annotation.NonNull;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.regex.Pattern;
+
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.AbstractHuami2021FWInstallHandler;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance.AmazfitBalanceSupport;
+
+public class AmazfitBalanceCoordinator extends Huami2021Coordinator {
+ private static final Logger LOG = LoggerFactory.getLogger(AmazfitBalanceCoordinator.class);
+
+ @NonNull
+ @Override
+ public Class extends DeviceSupport> getDeviceSupportClass() {
+ return AmazfitBalanceSupport.class;
+ }
+
+ @Override
+ public int getDeviceNameResource() {
+ return R.string.devicetype_amazfit_balance;
+ }
+
+ @Override
+ protected Pattern getSupportedDeviceName() {
+ return Pattern.compile(HuamiConst.AMAZFIT_BALANCE_NAME + ".*");
+ }
+
+ @Override
+ public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
+ return new AmazfitBalanceFWInstallHandler(uri, context);
+ }
+
+ @Override
+ public boolean supportsContinuousFindDevice() {
+ return true;
+ }
+
+ @Override
+ public boolean mainMenuHasMoreSection() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsGpxUploads() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsControlCenter() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsToDoList() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsWifiHotspot(final GBDevice device) {
+ return true;
+ }
+
+ @Override
+ public boolean supportsFtpServer(final GBDevice device) {
+ return true;
+ }
+
+ public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
+ return true;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWHelper.java
new file mode 100644
index 000000000..58d874c21
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWHelper.java
@@ -0,0 +1,44 @@
+/* Copyright (C) 2023 José Rebelo, Maxime Reyrolle
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
+
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance.AmazfitBalanceFirmwareInfo;
+
+public class AmazfitBalanceFWHelper extends HuamiFWHelper {
+ public AmazfitBalanceFWHelper(final Uri uri, final Context context) throws IOException {
+ super(uri, context);
+ }
+
+ @Override
+ public long getMaxExpectedFileSize() {
+ return 1024 * 1024 * 128; // 128.0MB
+ }
+
+ @Override
+ protected void determineFirmwareInfo(final byte[] wholeFirmwareBytes) {
+ firmwareInfo = new AmazfitBalanceFirmwareInfo(wholeFirmwareBytes);
+ if (!firmwareInfo.isHeaderValid()) {
+ throw new IllegalArgumentException("Not a Amazfit Balance firmware");
+ }
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWInstallHandler.java
new file mode 100644
index 000000000..adf17ea2a
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbalance/AmazfitBalanceFWInstallHandler.java
@@ -0,0 +1,50 @@
+/* Copyright (C) 2023 José Rebelo, Maxime Reyrolle
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance;
+
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.AbstractHuami2021FWInstallHandler;
+
+class AmazfitBalanceFWInstallHandler extends AbstractHuami2021FWInstallHandler {
+ AmazfitBalanceFWInstallHandler(final Uri uri, final Context context) {
+ super(uri, context);
+ }
+
+ @Override
+ protected String getFwUpgradeNotice() {
+ final String deviceName = mContext.getString(R.string.devicetype_amazfit_balance);
+ return mContext.getString(R.string.fw_upgrade_notice_zepp_os, helper.getHumanFirmwareVersion(), deviceName);
+ }
+
+ @Override
+ protected HuamiFWHelper createHelper(final Uri uri, final Context context) throws IOException {
+ return new AmazfitBalanceFWHelper(uri, context);
+ }
+
+ @Override
+ protected boolean isSupportedDeviceType(final GBDevice device) {
+ return device.getType() == DeviceType.AMAZFITBALANCE;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
index 8156056d1..111eedc8f 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
@@ -48,6 +48,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.Q8Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.SG2Coordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance.AmazfitBalanceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband5.AmazfitBand5Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7.AmazfitBand7Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipCoordinator;
@@ -202,6 +203,7 @@ public enum DeviceType {
AMAZFITTREXULTRA(10055, AmazfitTRexUltraCoordinator.class),
AMAZFITGTRMINI(10056, AmazfitGTRMiniCoordinator.class),
AMAZFITFALCON(10057, AmazfitFalconCoordinator.class),
+ AMAZFITBALANCE(10058, AmazfitBalanceCoordinator.class),
HPLUS(40, HPlusCoordinator.class),
MAKIBESF68(41, MakibesF68Coordinator.class),
EXRIZUK8(42, EXRIZUK8Coordinator.class),
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceFirmwareInfo.java
new file mode 100644
index 000000000..68391dd40
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceFirmwareInfo.java
@@ -0,0 +1,58 @@
+/* Copyright (C) 2023 José Rebelo, Maxime Reyrolle
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.Huami2021FirmwareInfo;
+
+public class AmazfitBalanceFirmwareInfo extends Huami2021FirmwareInfo {
+ private static final Map crcToVersion = new HashMap() {{
+ // firmware
+ }};
+
+ public AmazfitBalanceFirmwareInfo(final byte[] bytes) {
+ super(bytes);
+ }
+
+ @Override
+ public String deviceName() {
+ return HuamiConst.AMAZFIT_BALANCE_NAME;
+ }
+
+ @Override
+ public Set deviceSources() {
+ return new HashSet<>(Arrays.asList(8519936, 8519937, 8519939));
+ }
+
+ @Override
+ public boolean isGenerallyCompatibleWith(final GBDevice device) {
+ return isHeaderValid() && device.getType() == DeviceType.AMAZFITBALANCE;
+ }
+
+ @Override
+ protected Map getCrcMap() {
+ return crcToVersion;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceSupport.java
new file mode 100644
index 000000000..237b2b572
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbalance/AmazfitBalanceSupport.java
@@ -0,0 +1,33 @@
+/* Copyright (C) 2023 José Rebelo, Maxime Reyrolle
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbalance;
+
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbalance.AmazfitBalanceFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.Huami2021Support;
+
+public class AmazfitBalanceSupport extends Huami2021Support {
+ @Override
+ public HuamiFWHelper createFWHelper(final Uri uri, final Context context) throws IOException {
+ return new AmazfitBalanceFWHelper(uri, context);
+ }
+}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d39539a87..f838d5bfa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1293,6 +1293,7 @@
Mi Band 5
Mi Band 6
Xiaomi Smart Band 7
+ Amazfit Balance
Amazfit Cheetah (Square)
Amazfit Cheetah (Round)
Amazfit Cheetah Pro