mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-11-08 09:52:07 +01:00
69 lines
1.8 KiB
ReStructuredText
69 lines
1.8 KiB
ReStructuredText
PN532 NFC/RFID Tag
|
|
==================
|
|
|
|
.. seo::
|
|
:description: Instructions for setting up NFC tags for the PN532 integration.
|
|
:image: pn532.jpg
|
|
|
|
The ``pn532`` binary sensor platform lets you track if an NFC/RFID tag with a given
|
|
unique id (``uid``) is currently being detected by the PN532 or not.
|
|
|
|
.. figure:: images/pn532-full.jpg
|
|
:align: center
|
|
:width: 60.0%
|
|
|
|
See :doc:`/components/pn532` for instructions for setting up the connection to the PN532.
|
|
|
|
.. code-block:: yaml
|
|
|
|
# Example configuration entry
|
|
spi:
|
|
clk_pin: D0
|
|
miso_pin: D1
|
|
mosi_pin: D2
|
|
|
|
pn532:
|
|
cs_pin: D3
|
|
update_interval: 1s
|
|
|
|
binary_sensor:
|
|
- platform: pn532
|
|
uid: 74-10-37-94
|
|
name: "PN532 NFC Tag"
|
|
|
|
Configuration variables:
|
|
------------------------
|
|
|
|
- **uid** (**Required**, string): The unique ID of the NFC/RFID tag. This is a hyphen-separated list
|
|
of hexadecimal values. For example ``74-10-37-94``.
|
|
- **name** (**Required**, string): The name of the binary sensor.
|
|
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
|
|
- All other options from :ref:`Binary Sensor <config-binary_sensor>`.
|
|
|
|
.. _pn532-setting_up_tags:
|
|
|
|
Setting Up Tags
|
|
---------------
|
|
|
|
To set up binary sensors for specific NFC tags you first have to know their unique IDs. To obtain this
|
|
id, first set up a simple pn532 configuration without any binary sensors like above.
|
|
|
|
When your code is running and you approach the PN532 with an NFC Tag, you should see a message like this:
|
|
|
|
.. code::
|
|
|
|
Found new tag '74-10-37-94'
|
|
|
|
Then copy this id and create a ``binary_sensor`` entry as in the configuration example. Repeat this process for
|
|
each tag.
|
|
|
|
See Also
|
|
--------
|
|
|
|
- :doc:`/components/pn532`
|
|
- :doc:`index`
|
|
- :apiref:`binary_sensor/pn532_component.h`
|
|
- :ghedit:`Edit`
|
|
|
|
.. disqus::
|