From 96a8b9aeaee04fe8f9b27bcd89665664d640a99e Mon Sep 17 00:00:00 2001 From: Severin von Wnuck-Lipinski Date: Tue, 13 Aug 2024 19:51:04 +0200 Subject: [PATCH] Add support for Mijia XMWSDJ04MMC --- .../mijia_lywsd/MijiaXmwsdj04Coordinator.java | 48 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 2 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 51 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd/MijiaXmwsdj04Coordinator.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd/MijiaXmwsdj04Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd/MijiaXmwsdj04Coordinator.java new file mode 100644 index 000000000..7a87e2f5f --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd/MijiaXmwsdj04Coordinator.java @@ -0,0 +1,48 @@ +/* Copyright (C) 2024 Severin von Wnuck-Lipinski + + 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.mijia_lywsd; + +import java.util.regex.Pattern; + +import nodomain.freeyourgadget.gadgetbridge.R; + +public class MijiaXmwsdj04Coordinator extends AbstractMijiaLywsdCoordinator { + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("XMWSDJ04MMC"); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_mijia_xmwsdj04; + } + + @Override + public int getDefaultIconResource() { + return R.drawable.ic_device_thermometer; + } + + @Override + public int getDisabledIconResource() { + return R.drawable.ic_device_thermometer_disabled; + } + + @Override + public boolean supportsSetTime() { + return false; + } +} 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 e17761727..1d9d6b67a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -191,6 +191,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.makibeshr3.MakibesHR3Coordin import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.mijia_lywsd.MijiaLywsd02Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.mijia_lywsd.MijiaLywsd03Coordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.mijia_lywsd.MijiaXmwsdj04Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.mijia_lywsd.MijiaMhoC303Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.miscale.MiSmartScaleCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.miscale.MiCompositionScaleCoordinator; @@ -370,6 +371,7 @@ public enum DeviceType { PINETIME_JF(PineTimeJFCoordinator.class), MIJIA_LYWSD02(MijiaLywsd02Coordinator.class), MIJIA_LYWSD03(MijiaLywsd03Coordinator.class), + MIJIA_XMWSDJ04(MijiaXmwsdj04Coordinator.class), MIJIA_MHO_C303(MijiaMhoC303Coordinator.class), LEFUN(LefunDeviceCoordinator.class), VIVITAR_HR_BP_MONITOR_ACTIVITY_TRACKER(VivitarHrBpMonitorActivityTrackerCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 796f8a8cc..7d9cb4614 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1750,6 +1750,7 @@ BFH-16 Mijia Smart Clock Mijia Temperature and Humidity Sensor 2 + Mijia Temperature and Humidity Sensor 2 (E-ink) Mijia MHO-C303 Makibes HR3 Bangle.js