ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
nfc_binary_sensor.h
Go to the documentation of this file.
1#pragma once
2
9
10namespace esphome::nfc {
11
13 public:
14 void setup() override;
15 void dump_config() override;
16
17 // Both keep the pointer; the string must outlive the sensor (codegen passes a literal)
18 void set_ndef_match_string(const char *str);
19 void set_tag_name(const char *str);
20 void set_uid(const NfcTagUid &uid);
21
22 bool tag_match_ndef_string(const std::shared_ptr<NdefMessage> &msg);
23 bool tag_match_tag_name(const std::shared_ptr<NdefMessage> &msg);
24 bool tag_match_uid(const NfcTagUid &data);
25
26 void tag_off(NfcTag &tag) override;
27 void tag_on(NfcTag &tag) override;
28
29 protected:
30 bool match_tag_name_{false};
33};
34
35} // namespace esphome::nfc
StringRef is a reference to a string owned by something else.
Definition string_ref.h:31
Base class for all binary_sensor-type classes.
bool tag_match_tag_name(const std::shared_ptr< NdefMessage > &msg)
void tag_on(NfcTag &tag) override
void set_ndef_match_string(const char *str)
bool tag_match_uid(const NfcTagUid &data)
void set_uid(const NfcTagUid &uid)
void tag_off(NfcTag &tag) override
bool tag_match_ndef_string(const std::shared_ptr< NdefMessage > &msg)