From c941bc4109a4fc7c1ae9553e48907c295ef7491a Mon Sep 17 00:00:00 2001 From: Samuel Sieb Date: Tue, 16 May 2023 14:30:14 -0700 Subject: [PATCH] handle Wiegand 8-bit keys (#4837) Co-authored-by: Samuel Sieb --- esphome/components/wiegand/wiegand.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/esphome/components/wiegand/wiegand.cpp b/esphome/components/wiegand/wiegand.cpp index c4e834c85a..10c77a8aa2 100644 --- a/esphome/components/wiegand/wiegand.cpp +++ b/esphome/components/wiegand/wiegand.cpp @@ -102,6 +102,16 @@ void Wiegand::loop() { uint8_t key = KEYS[value]; this->send_key_(key); } + } else if (count == 8) { + if ((value ^ 0xf0) >> 4 == (value & 0xf)) { + value &= 0xf; + for (auto *trigger : this->key_triggers_) + trigger->trigger(value); + if (value < 12) { + uint8_t key = KEYS[value]; + this->send_key_(key); + } + } } else { ESP_LOGD(TAG, "received unknown %d-bit value: %llx", count, value); }