From 9ca9fd503ef048a15fa0e84120d16af063d5744f Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 21 Sep 2020 01:30:37 +1200 Subject: [PATCH] Add docs for homeassistant.tag_scanned action (#763) * Add docs for homeassistant.tag_scanned * Add pn532 example * Add example to rdm6300 --- components/api.rst | 20 ++++++++++++++++++++ components/binary_sensor/pn532.rst | 11 +++++++++++ components/binary_sensor/rdm6300.rst | 11 +++++++++++ 3 files changed, 42 insertions(+) diff --git a/components/api.rst b/components/api.rst index 96a59ab10..edc55822e 100644 --- a/components/api.rst +++ b/components/api.rst @@ -208,6 +208,26 @@ Configuration options: - **variables** (*Optional*, mapping): Optional variables that can be used in the ``data_template``. Values are :ref:`lambdas ` and will be evaluated before sending the request. + +.. _api-homeassistant_tag_scanned_action: + +``homeassistant.tag_scanned`` Action +------------------------------------ + +When using the native API with Home Assistant, you can push tag_scanned to Home Assistant +straight from ESPHome :ref:`Automations `. + +.. code-block:: yaml + + # In some trigger + on_...: + # Simple + - homeassistant.tag_scanned: some-tag + +Configuration options: + +- **tag** (**Required**, :ref:`templatable `, string): The id of the scanned tag + See Also -------- diff --git a/components/binary_sensor/pn532.rst b/components/binary_sensor/pn532.rst index c645f2d45..51e9667c7 100644 --- a/components/binary_sensor/pn532.rst +++ b/components/binary_sensor/pn532.rst @@ -86,6 +86,17 @@ The parameter ``x`` this trigger provides is of type ``std::string`` and is the topic: pn532/tag payload: !lambda 'return x;' +A tag scanned event can also be sent to the Home Assistant tag component +using :ref:`api-homeassistant_tag_scanned_action`. + +.. code-block:: yaml + + pn532: + # ... + on_tag: + then: + - homeassistant.tag_scanned: !lambda 'return x;' + .. _pn532-tag: NFC/RFID Tag diff --git a/components/binary_sensor/rdm6300.rst b/components/binary_sensor/rdm6300.rst index c28992e76..2f44bb06d 100644 --- a/components/binary_sensor/rdm6300.rst +++ b/components/binary_sensor/rdm6300.rst @@ -70,6 +70,17 @@ unsigned integer. topic: rdm6300/tag payload: !lambda 'return uint32_to_string(x);' +A tag scanned event can also be sent to the Home Assistant tag component +using :ref:`api-homeassistant_tag_scanned_action`. + +.. code-block:: yaml + + rdm6300: + # ... + on_tag: + then: + - homeassistant.tag_scanned: !lambda 'return uint32_to_string(x);' + .. _rdm6300-tag: NFC/RFID Tag