Skip to content

Commit

Permalink
Component reshuffle (esphome#183)
Browse files Browse the repository at this point in the history
* Merge remote receiver component with platform

* Merged remote transmitter component with platform

* Merge pca9685 component with output

* Minor fixes

* Minor fix

* Fixed headers

* reshuffled esp32 touch binary sensor

* Reshuffled pn532 rfid reader

* Fixed images

* Reshuffled rdm6300 RFID component

* Reshuffled my9231 led driver component

* Reshuffled ads1115 component

* Reshuffled SSD1306 display component

* Reshuffled Character-Based LCD Display component

* Reshuffled fastled component

* Fixes netlify

* Remove duplicate figure

* Remove duplicate figure

* Remove duplicate figure

* Reorder SSD1306

To my knowledge, the i2c version is more common, so put it first.

* Put fastled clockless above SPI

clockless is more common, so put it first

* Cleanup index

Tag was used initially to distinguish between the component and binary sensor, no longer needed.

* Remove duplicate figure
  • Loading branch information
FrengerH authored and OttoWinter committed Feb 27, 2019
1 parent 8957c35 commit e16c324
Show file tree
Hide file tree
Showing 32 changed files with 819 additions and 927 deletions.
8 changes: 4 additions & 4 deletions changelog/v1.7.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ be travelling a lot (and enjoying my vacation 😎), so don't expect too many aw
Pulse Counter for ESP8266, components/sensor/pulse_counter, pulse.svg
Remote Transmitter, components/switch/remote_transmitter, remote.svg

Remote Receiver, components/remote_receiver, remote.svg
Remote Receiver, components/binary_sensor/remote_receiver, remote.svg

New Components
**************
Expand All @@ -52,8 +52,8 @@ New Components
measure how much of the time a specific pin is HIGH or LOW. Can for example be used to detect if a status LED
on an external device is blinking or permanently on.

- The new :doc:`remote receiver </components/remote_transmitter>` and
:doc:`remote transmitter </components/remote_receiver>` components now allows you to use any 433MHz
- The new :doc:`remote receiver </components/binary_sensor/remote_receiver>` and
:doc:`remote transmitter </components/switch/remote_transmitter>` components now allows you to use any 433MHz
receivers and senders with ESPHome. Currently, you will need to use the ``raw`` data as described in
:ref:`this guide <finding_remote_codes>`, but in the future more protocols will be supported out of the box.

Expand Down Expand Up @@ -118,7 +118,7 @@ Breaking Changes
- The ``receive_timeout`` option has been removed from the :doc:`i2c component </components/i2c>` as it
turns out it didn't actually do anything.

- The ``ir_transmitter`` component has been renamed to :doc:`remote_transmitter </components/remote_transmitter>`
- The ``ir_transmitter`` component has been renamed to :doc:`remote_transmitter </components/switch/remote_transmitter>`
as it now works with all kinds of protocols, not just infrared-based ones.

- The ``pull_mode`` option of the :doc:`Pulse Counter </components/sensor/pulse_counter>` has been removed, please
Expand Down
10 changes: 5 additions & 5 deletions changelog/v1.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ Version 1.8.0

Waveshare E-Paper, components/display/waveshare_epaper, waveshare_epaper.jpg
Nextion, components/display/nextion, nextion.jpg
SSD1306, components/display/ssd1306_i2c, ssd1306.jpg
SSD1306, components/display/ssd1306, ssd1306.jpg

MAX7219, components/display/max7219, max7219.jpg
LCD Display, components/display/lcd_gpio, lcd.jpg
LCD Display, components/display/lcd_display, lcd.jpg
RCSwitch Integration, components/switch/remote_transmitter.html#rcswitch-remote-codes, remote.svg

SPI Bus, components/spi, spi.svg
UART Bus, components/uart, uart.svg
Real Time Clock, components/time, clock-outline.svg

Uptime Sensor, components/sensor/uptime, timer.svg
PN532, components/pn532, pn532.jpg
RDM6300, components/rdm6300, rdm6300.jpg
PN532, components/binary_sensor/pn532, pn532.jpg
RDM6300, components/binary_sensor/rdm6300, rdm6300.jpg

BLE RSSI, components/sensor/ble_rssi, bluetooth.svg
Xiaomi MiFlora, components/sensor/xiaomi_miflora, xiaomi_miflora.jpg
Expand Down Expand Up @@ -54,7 +54,7 @@ This release mainly focuses on these new features:
- Lots of Bug Fixes - Now that most of the hardware has arrived from china, I was able to fix a bunch
of bugs with a lot of integrations.
- :doc:`Displays! </components/display/index>`
- NFC/RFID Readers (:doc:`PN532 </components/pn532>` and :doc:`RDM6300 </components/rdm6300>`)
- NFC/RFID Readers (:doc:`PN532 </components/binary_sensor/pn532>` and :doc:`RDM6300 </components/binary_sensor/rdm6300>`)
- New :doc:`ESP32 BLE integrations </components/esp32_ble_tracker>` like :doc:`Xiaomi MiFlora </components/sensor/xiaomi_miflora>`
- Core Changes like the addition of the :ref:`SPI bus <spi>` and :ref:`UART bus <uart>`
- Lots of new :ref:`light effects <light-effects>` and support for cold-white/warm-white lights.
Expand Down
6 changes: 3 additions & 3 deletions changelog/v1.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Changelog - Version 1.9.0

esphomeflasher, guides/faq.html#i-can-t-get-flashing-over-usb-to-work, logo.svg
Total Daily Energy, components/sensor/total_daily_energy, sigma.svg
MY9231/MY9291 LED driver, components/my9231, my9231.svg
MY9231/MY9291 LED driver, components/output/my9231, my9231.svg


It's time for another release of esphomelib: 1.9.0. This release is quite different from the last one,
Expand Down Expand Up @@ -114,7 +114,7 @@ New Features
- Added :ref:`binary_sensor-on_multi_click` trigger to distinguish between double, long, and single clicks.
(:libpr:`262`, :docspr:`77`, :yamlpr:`226`)

- Added an :ref:`pn532-on_tag` to :doc:`PN532 NFC Readers </components/pn532>` so that automations
- Added an :ref:`pn532-on_tag` to :doc:`PN532 NFC Readers </components/binary_sensor/pn532>` so that automations
can directly use the NFC tag ID
(:libpr:`194`, :yamlpr:`189`, :docspr:`57`)

Expand All @@ -127,7 +127,7 @@ New Features
- You now have to option to have a different log level for log messages sent over MQTT (:ref:`docs <mqtt-message>`,
:yamlpr:`167`, :docspr:`51`)

- Added a color correction option to :doc:`FastLED addressable lights </components/light/fastled_clockless>`
- Added a color correction option to :doc:`FastLED addressable lights </components/light/fastled>`
(:libpr:`234`, :yamlpr:`200`, :docspr:`64`)

- Added a ``clean`` command to esphomeyaml to fix some occasional build errors
Expand Down
56 changes: 0 additions & 56 deletions components/ads1115.rst

This file was deleted.

67 changes: 61 additions & 6 deletions components/binary_sensor/esp32_touch.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,70 @@
ESP32 Touch Pad Binary Sensor
=============================
ESP32 Touch Pad
===============

.. seo::
:description: Instructions for setting up the touch pad on the ESP32.
:image: touch.png

.. _esp32-touch-component:

Component/Hub
-------------

The ``esp32_touch`` component creates a global hub for detecting touches on
the eight touch pads of the ESP32 as :ref:`binary senors <esp32-touch-binary-sensor>`.

.. code-block:: yaml
# Example configuration entry
esp32_touch:
setup_mode: False
binary_sensor:
- platform: esp32_touch
name: "ESP32 Touch Pad GPIO27"
pin: GPIO27
threshold: 1000
Configuration variables:
************************

- **setup_mode** (*Optional*, boolean): Whether debug messages with the touch pad value should
be displayed in the logs. Useful for finding out suitable thresholds for the binary sensors, but
spam the logs. See :ref:`setting up touch pads <esp32-touch-binary-sensor>`
for more information. Defaults to false.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID for code generation.

Advanced options (the defaults are usually quite good, but if you're having accuracy issues, use these):

- **iir_filter** (*Optional*, :ref:`config-time`): Optionally set up an
`Infinite Impulse Response <https://en.wikipedia.org/wiki/Infinite_impulse_response>`__
filter should be applied to all touch pads. This can increase the accuracy of the touch pads a lot, but
higher values decrease the response time. A good value to start with is ``10ms``. Default is no IIR filter.
- **sleep_duration** (*Optional*, :ref:`config-time`): Set a time period
denoting the amount of time the touch peripheral should sleep between measurements. This can decrease
power usage but make the sensor slower. Default is about 27 milliseconds.
- **measurement_duration** (*Optional*, :ref:`config-time`): Set the conversion
time for all touch pads. A longer conversion time means that more charge/discharge cycles of the touch pad
can be performed, therefore increasing accuracy. Default is about 8ms, the maximum amount.
- **low_voltage_reference** (*Optional*): The low voltage reference to use for the charge cycles. See
the `esp-idf docs <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/touch_pad.html#optimization-of-measurements>`__
for a nice explanation of this. One of ``0.5V``, ``0.6V``, ``0.7V``, ``0.8V``. Default is ``0.5V``.
- **high_voltage_reference** (*Optional*): The high voltage reference to use for the charge cycles. See
the `esp-idf docs <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/touch_pad.html#optimization-of-measurements>`__
for a nice explanation of this. One of ``2.4V``, ``2.5V``, ``2.6V``, ``2.7V``. Default is ``2.7V``.
- **voltage_attenuation** (*Optional*): The voltage attenuation to use for the charge cycles. See
the `esp-idf docs <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/touch_pad.html#optimization-of-measurements>`__
for a nice explanation of this. One of ``1.5V``, ``1V``, ``0.5V``, ``0V``. Default is ``0V``.

.. _esp32-touch-binary-sensor:

Binary Sensor
-------------

The ``esp32_touch`` binary sensor platform lets you use the touch peripheral of the
ESP32 to detect if a certain pin is being "touched".

First, you need to setup the :doc:`global touch hub </components/esp32_touch>`. Then
First, you need to setup the :ref:`global touch hub <esp32-touch-component>`. Then
you can add individual touch pads as binary sensors. When a touch is detected on these pins, the binary
sensor will report an ``ON`` state. And, of course, if no touch is detected, the binary sensor will report
an ``OFF`` state.
Expand All @@ -29,7 +85,7 @@ an ``OFF`` state.
threshold: 1000
Configuration variables:
------------------------
************************

- **pin** (**Required**, :ref:`config-pin`): The pin to detect touch
events on.
Expand Down Expand Up @@ -66,7 +122,7 @@ raw values mean that it is more likely that a touch is happening. For example, v
1000 to 1600 usually mean the pad is not being touched, and values in the range of 600 and less
mean the pad is probably being touched.

To find suitable threshold values, first configure the :doc:`ESP32 touch hub </components/esp32_touch>`
To find suitable threshold values, first configure the :ref:`ESP32 touch hub <esp32-touch-component>`
to output measured values using the ``setup_mode:`` configuration option. Next, add some binary sensors
for the touch pads you want to observe. Also put some threshold in the configuration as seen below
to make the validator happy, we are going to find good thresholds in a moment anyway.
Expand Down Expand Up @@ -98,7 +154,6 @@ down.
See Also
--------

- :doc:`/components/esp32_touch`
- :doc:`/components/binary_sensor/index`
- :apiref:`binary_sensor/esp32_touch_binary_sensor.h`
- `esp-idf Touch Sensor API <https://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/touch_pad.html>`__
Expand Down
96 changes: 88 additions & 8 deletions components/binary_sensor/pn532.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,98 @@
PN532 NFC/RFID Tag
==================
PN532 NFC/RFID
==============

.. seo::
:description: Instructions for setting up NFC tags for the PN532 integration.
:description: Instructions for setting up PN532 NFC tag readers and tags in ESPHome
:image: pn532.jpg
:keywords: PN532, NFC, RFID

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.
.. _pn532-component:

Component/Hub
-------------

The ``pn532`` component allows you to use PN532 NFC/RFID controllers
(`datasheet <https://cdn-shop.adafruit.com/datasheets/pn532ds.pdf>`__, `adafruit <https://www.adafruit.com/product/364>`__)
with ESPHome. This component is a global hub that establishes the connection to the PN532 via :ref:`SPI <spi>` and
outputs its data. Using the :ref:`PN532 binary sensors <pn532-tag>` you can then
create individual binary sensors that track if an NFC/RFID tag is currently detected by the PN532.

.. figure:: images/pn532-full.jpg
:align: center
:width: 60.0%

See :doc:`/components/pn532` for instructions for setting up the connection to the PN532.
See :ref:`pn532-setting_up_tags` for information on how to setup individual binary sensors for this component.

As the communication with the PN532 is done using SPI for this integration, you need to set the two switches on
the board to the SPI mode (usually by setting the first one to OFF and the second one to ON). Additionally, you need
to have an :ref:`spi bus <spi>` in your configuration with both the **miso_pin** and **mosi_pin** set.

.. 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:
************************

- **cs_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin on the ESP that the chip select line
is connected to.
- **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.

.. figure:: images/pn532-spi.jpg
:align: center
:width: 80.0%

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-block:: yaml
pn532:
# ...
on_tag:
then:
- mqtt.publish:
topic: pn532/tag
payload: !lambda 'return x;'
.. _pn532-tag:

NFC/RFID Tag
------------

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.

.. code-block:: yaml
Expand All @@ -32,7 +112,7 @@ See :doc:`/components/pn532` for instructions for setting up the connection to t
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``.
Expand Down Expand Up @@ -60,8 +140,8 @@ each tag.
See Also
--------

- :doc:`/components/pn532`
- :doc:`index`
- :doc:`rdm6300`
- :apiref:`binary_sensor/pn532_component.h`
- :ghedit:`Edit`

Expand Down
Loading

0 comments on commit e16c324

Please sign in to comment.