mirror of
https://github.com/esphome/esphome.git
synced 2025-09-16 02:02:21 +01:00
Add on_tag_removed trigger for RC522 (#4742)
This commit is contained in:
@@ -256,7 +256,7 @@ void RC522::loop() {
|
||||
|
||||
this->current_uid_ = rfid_uid;
|
||||
|
||||
for (auto *trigger : this->triggers_)
|
||||
for (auto *trigger : this->triggers_ontag_)
|
||||
trigger->process(rfid_uid);
|
||||
|
||||
if (report) {
|
||||
@@ -265,6 +265,11 @@ void RC522::loop() {
|
||||
break;
|
||||
}
|
||||
case STATE_DONE: {
|
||||
if (!this->current_uid_.empty()) {
|
||||
ESP_LOGV(TAG, "Tag '%s' removed", format_uid(this->current_uid_).c_str());
|
||||
for (auto *trigger : this->triggers_ontagremoved_)
|
||||
trigger->process(this->current_uid_);
|
||||
}
|
||||
this->current_uid_ = {};
|
||||
state_ = STATE_INIT;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user