mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
Amazfit Bip/Cor: Send fake AQI 0 to make current weather appear
I have no idea why this is necessary. But at least it makes the current weather visible :/
This commit is contained in:
parent
eec0a4dc4c
commit
8fbf97f713
@ -162,7 +162,32 @@ public class AmazfitBipSupport extends MiBand2Support {
|
||||
|
||||
builder.write(getCharacteristic(AmazfitBipService.UUID_CHARACTERISTIC_WEATHER), buf.array());
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException ignore) {
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Error sending current weather", ex);
|
||||
}
|
||||
|
||||
try {
|
||||
TransactionBuilder builder;
|
||||
builder = performInitialized("Sending air quality index");
|
||||
int length = 8;
|
||||
String aqiString = "(fake)";
|
||||
if (supportsConditionString) {
|
||||
length += aqiString.getBytes().length + 1;
|
||||
}
|
||||
ByteBuffer buf = ByteBuffer.allocate(length);
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
buf.put((byte) 4);
|
||||
buf.putInt(weatherSpec.timestamp);
|
||||
buf.put((byte) (tz_offset_hours * 4));
|
||||
buf.putShort((short) 0);
|
||||
if (supportsConditionString) {
|
||||
buf.put(aqiString.getBytes());
|
||||
buf.put((byte) 0);
|
||||
}
|
||||
builder.write(getCharacteristic(AmazfitBipService.UUID_CHARACTERISTIC_WEATHER), buf.array());
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException ex) {
|
||||
LOG.error("Error sending air quality");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -216,7 +241,7 @@ public class AmazfitBipSupport extends MiBand2Support {
|
||||
builder.write(getCharacteristic(AmazfitBipService.UUID_CHARACTERISTIC_WEATHER), buf.array());
|
||||
builder.queue(getQueue());
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Error sending weather information to the Bip", ex);
|
||||
LOG.error("Error sending weather forecast", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user