mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
Add PN532 On Tag Trigger (#57)
This commit is contained in:
parent
a15e0b176f
commit
8241cacf60
@ -42,6 +42,8 @@ Configuration variables:
|
||||
- **update_interval** (*Optional*, :ref:`config-time`): The duration of each scan on the PN532. This affects the
|
||||
duration that the individual binary sensors stay active when they're found.
|
||||
If a device is not found within this time window, it will be marked as not present. Defaults to 1s.
|
||||
- **on_tag** (*Optional*, :ref:`Automation <automation>`): An automation to perform
|
||||
when a tag is read. See :ref:`pn532-on_tag`.
|
||||
- **spi_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`SPI Component <spi>` if you want
|
||||
to use multiple SPI buses.
|
||||
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID for this component.
|
||||
@ -52,6 +54,28 @@ Configuration variables:
|
||||
|
||||
Example for hooking up the PN532 via SPI. Notice the position of the two switches on the right.
|
||||
|
||||
.. _pn532-on_tag:
|
||||
|
||||
``on_tag``
|
||||
----------
|
||||
|
||||
This automation will be triggered when the PN532 module responds with a tag. Please note that this
|
||||
can be called quite often (with an interval of ``update_interval``) as it's triggered repeatedly
|
||||
if the tag is re-read many times.
|
||||
|
||||
The parameter ``x`` this trigger provides is of type ``std::string`` and is the tag UID in the format
|
||||
``74-10-37-94``. The configuration below will for example publish the tag ID on the MQTT topic ``pn532/tag``.
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
pn532:
|
||||
# ...
|
||||
on_tag:
|
||||
then:
|
||||
- mqtt.publish:
|
||||
topic: pn532/tag
|
||||
payload: !lambda 'return x;'
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
|
@ -303,6 +303,7 @@ All Triggers
|
||||
- :ref:`esphomeyaml.on_boot <esphomeyaml-on_boot>`
|
||||
- :ref:`esphomeyaml.on_shutdown <esphomeyaml-on_shutdown>`
|
||||
- :ref:`esphomeyaml.on_loop <esphomeyaml-on_loop>`
|
||||
- :ref:`pn532.on_tag <pn532-on_tag>`
|
||||
|
||||
All Actions
|
||||
-----------
|
||||
|
Loading…
Reference in New Issue
Block a user