1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-01 09:32:21 +01:00

Add optional bindkey support for CGG1. (#1407)

This commit is contained in:
Diego Elio Pettenò
2021-03-25 18:33:06 +00:00
committed by GitHub
parent 46356cbc4a
commit a6255c31fe
4 changed files with 27 additions and 4 deletions

View File

@@ -103,7 +103,7 @@ bool parse_xiaomi_message(const std::vector<uint8_t> &message, XiaomiParseResult
return false;
}
while (payload_length > 0) {
while (payload_length > 3) {
if (payload[payload_offset + 1] != 0x10) {
ESP_LOGVV(TAG, "parse_xiaomi_message(): fixed byte not found, stop parsing residual data.");
break;
@@ -171,7 +171,10 @@ optional<XiaomiParseResult> parse_xiaomi_header(const esp32_ble_tracker::Service
result.type = XiaomiParseResult::TYPE_MUE4094RT;
result.name = "MUE4094RT";
result.raw_offset -= 6;
} else if ((raw[2] == 0x47) && (raw[3] == 0x03)) { // round body, e-ink display
} else if ((raw[2] == 0x47) && (raw[3] == 0x03)) { // ClearGrass-branded, round body, e-ink display
result.type = XiaomiParseResult::TYPE_CGG1;
result.name = "CGG1";
} else if ((raw[2] == 0x48) && (raw[3] == 0x0B)) { // Qingping-branded, round body, e-ink display — with bindkeys
result.type = XiaomiParseResult::TYPE_CGG1;
result.name = "CGG1";
} else if ((raw[2] == 0xbc) && (raw[3] == 0x03)) { // VegTrug Grow Care Garden