Colmi R09: Do not try to parse temperature packets without data

This commit is contained in:
Arjan Schrijver 2025-01-02 16:58:07 +01:00
parent a6e4adc442
commit af10677157

View File

@ -494,6 +494,10 @@ public class ColmiR0xPacketHandler {
public static void historicalTemperature(GBDevice device, byte[] value) { public static void historicalTemperature(GBDevice device, byte[] value) {
ArrayList<ColmiTemperatureSample> temperatureSamples = new ArrayList<>(); ArrayList<ColmiTemperatureSample> temperatureSamples = new ArrayList<>();
int length = BLETypeConversions.toUint16(value[2], value[3]); int length = BLETypeConversions.toUint16(value[2], value[3]);
if (length < 50) {
LOG.info("Received temperature data packet with length {} while expecting 50. Will not try to parse it.", length);
return;
}
int index = 6; // start of data (day nr, followed by values) int index = 6; // start of data (day nr, followed by values)
int days_ago = -1; int days_ago = -1;
while (days_ago != 0 && index - 6 < length) { while (days_ago != 0 && index - 6 < length) {