mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
Merge branch 'next' into bump-2022.10.0b1
This commit is contained in:
commit
f8c31b2a86
2
Doxygen
2
Doxygen
@ -38,7 +38,7 @@ PROJECT_NAME = "ESPHome"
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 2022.9.4
|
PROJECT_NUMBER = 2022.10.0-dev
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
ESPHOME_PATH = ../esphome
|
ESPHOME_PATH = ../esphome
|
||||||
ESPHOME_REF = 2022.9.4
|
ESPHOME_REF = dev
|
||||||
|
|
||||||
.PHONY: html html-strict cleanhtml deploy help live-html Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
|
.PHONY: html html-strict cleanhtml deploy help live-html Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
|
||||||
|
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
# Moved components
|
# Moved components
|
||||||
# e.g: /components/sensors/abc.html /components/sensors/xyz.html 301
|
# e.g: /components/sensors/abc.html /components/sensors/xyz.html 301
|
||||||
/components/sensor/sgp40.html /components/sensor/sgp4x.html 301
|
/components/sensor/sgp40.html /components/sensor/sgp4x.html 301
|
||||||
|
/components/binary_sensor/xpt2046.html /components/touchscreen/xpt2046.html 301
|
||||||
|
@ -1 +1 @@
|
|||||||
2022.9.4
|
2022.10.0-dev
|
@ -102,7 +102,7 @@ This platform utilises the library's generic one-size-fits-all API, which might
|
|||||||
|
|
||||||
Additional configuration must be specified for this platform:
|
Additional configuration must be specified for this platform:
|
||||||
|
|
||||||
- **protocol** (**Required**, string): Choose one of Arduino-HeatpumpIR's supported protcols: ``aux``, ``ballu``, ``carrier_mca``, ``carrier_nqv``, ``daikin_arc417``, ``daikin_arc480``, ``daikin``, ``electroluxyal``, ``fuego``, ``fujitsu_awyz``, ``gree``, ``greeya``, ``greeyac``, ``greeyan``, ``hisense_aud``, ``hitachi``, ``hyundai``, ``ivt``, ``midea``, ``mitsubishi_fa``, ``mitsubishi_fd``, ``mitsubishi_fe``, ``mitsubishi_heavy_fdtc``, ``mitsubishi_heavy_zj``, ``mitsubishi_heavy_zm``, ``mitsubishi_heavy_zmp``, ``mitsubishi_heavy_kj``, ``mitsubishi_msc``, ``mitsubishi_msy``, ``mitsubishi_sez``, ``panasonic_ckp``, ``panasonic_dke``, ``panasonic_jke``, ``panasonic_lke``, ``panasonic_nke``, ``samsung_aqv``, ``samsung_fjm``, ``sharp``, ``toshiba_daiseikai``, ``toshiba``
|
- **protocol** (**Required**, string): Choose one of Arduino-HeatpumpIR's supported protcols: ``aux``, ``ballu``, ``carrier_mca``, ``carrier_nqv``, ``daikin_arc417``, ``daikin_arc480``, ``daikin``, ``electroluxyal``, ``fuego``, ``fujitsu_awyz``, ``gree``, ``greeya``, ``greeyac``, ``greeyan``, ``hisense_aud``, ``hitachi``, ``hyundai``, ``ivt``, ``midea``, ``mitsubishi_fa``, ``mitsubishi_fd``, ``mitsubishi_fe``, ``mitsubishi_heavy_fdtc``, ``mitsubishi_heavy_zj``, ``mitsubishi_heavy_zm``, ``mitsubishi_heavy_zmp``, ``mitsubishi_heavy_kj``, ``mitsubishi_msc``, ``mitsubishi_msy``, ``mitsubishi_sez``, ``panasonic_ckp``, ``panasonic_dke``, ``panasonic_jke``, ``panasonic_lke``, ``panasonic_nke``, ``samsung_aqv``, ``samsung_fjm``, ``sharp``, ``toshiba_daiseikai``, ``toshiba``, ``zhlt01``
|
||||||
- **horizontal_default** (**Required**, string): What to default to when the AC unit's horizontal direction is *not* set to swing. Options are: ``left``, ``mleft``, ``middle``, ``mright``, ``right``, ``auto``
|
- **horizontal_default** (**Required**, string): What to default to when the AC unit's horizontal direction is *not* set to swing. Options are: ``left``, ``mleft``, ``middle``, ``mright``, ``right``, ``auto``
|
||||||
- **vertical_default** (**Required**, string): What to default to when the AC unit's vertical direction is *not* set to swing. Options are: ``down``, ``mdown``, ``middle``, ``mup``, ``up``, ``auto``
|
- **vertical_default** (**Required**, string): What to default to when the AC unit's vertical direction is *not* set to swing. Options are: ``down``, ``mdown``, ``middle``, ``mup``, ``up``, ``auto``
|
||||||
- **max_temperature** (**Required**, float): The maximum temperature that the AC unit supports being set to.
|
- **max_temperature** (**Required**, float): The maximum temperature that the AC unit supports being set to.
|
||||||
@ -120,6 +120,8 @@ Additional configuration must be specified for this platform:
|
|||||||
internal temperature sensor; a value of 2 minutes seems to work well. See :doc:`/components/sensor/index`
|
internal temperature sensor; a value of 2 minutes seems to work well. See :doc:`/components/sensor/index`
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
|
- The ``zhlt01`` protocol supports multiple AC brands: Eurom, Chigo, Tristar, Tecnomaster, Elgin, Geant, Tekno, Topair, Proma, Sumikura, JBS, Turbo Air, Nakatomy, Celestial Air, Ager, Blueway, Airlux, etc.
|
||||||
|
|
||||||
.. _ir-receiver_id:
|
.. _ir-receiver_id:
|
||||||
|
|
||||||
Using a Receiver
|
Using a Receiver
|
||||||
|
@ -52,8 +52,6 @@ modes that Home Assistant offers.
|
|||||||
- platform: thermostat
|
- platform: thermostat
|
||||||
name: "Thermostat Climate Controller"
|
name: "Thermostat Climate Controller"
|
||||||
sensor: my_temperature_sensor
|
sensor: my_temperature_sensor
|
||||||
default_target_temperature_low: 20 °C
|
|
||||||
default_target_temperature_high: 22 °C
|
|
||||||
min_cooling_off_time: 300s
|
min_cooling_off_time: 300s
|
||||||
min_cooling_run_time: 300s
|
min_cooling_run_time: 300s
|
||||||
min_heating_off_time: 300s
|
min_heating_off_time: 300s
|
||||||
@ -66,6 +64,11 @@ modes that Home Assistant offers.
|
|||||||
idle_action:
|
idle_action:
|
||||||
- switch.turn_off: air_cond
|
- switch.turn_off: air_cond
|
||||||
- switch.turn_off: heater
|
- switch.turn_off: heater
|
||||||
|
default_preset: Home
|
||||||
|
preset:
|
||||||
|
- name: Home
|
||||||
|
default_target_temperature_low: 20 °C
|
||||||
|
default_target_temperature_high: 22 °C
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
@ -74,7 +77,6 @@ modes that Home Assistant offers.
|
|||||||
- platform: thermostat
|
- platform: thermostat
|
||||||
name: "Thermostat Climate Controller"
|
name: "Thermostat Climate Controller"
|
||||||
sensor: my_temperature_sensor
|
sensor: my_temperature_sensor
|
||||||
default_target_temperature_low: 20 °C
|
|
||||||
min_heating_off_time: 300s
|
min_heating_off_time: 300s
|
||||||
min_heating_run_time: 300s
|
min_heating_run_time: 300s
|
||||||
min_idle_time: 30s
|
min_idle_time: 30s
|
||||||
@ -82,6 +84,11 @@ modes that Home Assistant offers.
|
|||||||
- switch.turn_on: heater
|
- switch.turn_on: heater
|
||||||
idle_action:
|
idle_action:
|
||||||
- switch.turn_off: heater
|
- switch.turn_off: heater
|
||||||
|
default_preset: Home
|
||||||
|
preset:
|
||||||
|
- name: Home
|
||||||
|
default_target_temperature_low: 20 °C
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
@ -90,7 +97,6 @@ modes that Home Assistant offers.
|
|||||||
- platform: thermostat
|
- platform: thermostat
|
||||||
name: "Thermostat Climate Controller"
|
name: "Thermostat Climate Controller"
|
||||||
sensor: my_temperature_sensor
|
sensor: my_temperature_sensor
|
||||||
default_target_temperature_high: 22 °C
|
|
||||||
min_cooling_off_time: 300s
|
min_cooling_off_time: 300s
|
||||||
min_cooling_run_time: 300s
|
min_cooling_run_time: 300s
|
||||||
min_idle_time: 30s
|
min_idle_time: 30s
|
||||||
@ -98,6 +104,11 @@ modes that Home Assistant offers.
|
|||||||
- switch.turn_on: air_cond
|
- switch.turn_on: air_cond
|
||||||
idle_action:
|
idle_action:
|
||||||
- switch.turn_off: air_cond
|
- switch.turn_off: air_cond
|
||||||
|
default_preset: Home
|
||||||
|
preset:
|
||||||
|
- name: Home
|
||||||
|
default_target_temperature_high: 22 °C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Controller Behavior and Hysteresis
|
Controller Behavior and Hysteresis
|
||||||
@ -315,22 +326,6 @@ Set Point Options/Behavior
|
|||||||
- **supplemental_heating_delta** (*Required with* ``supplemental_heating_action``, float): When the temperature
|
- **supplemental_heating_delta** (*Required with* ``supplemental_heating_action``, float): When the temperature
|
||||||
difference between the lower set point and the current temperature exceeds this value,
|
difference between the lower set point and the current temperature exceeds this value,
|
||||||
``supplemental_heating_action`` will be called immediately.
|
``supplemental_heating_action`` will be called immediately.
|
||||||
- **away_config** (*Optional*, *Deprecated*): Additionally specify target temperature range settings for away mode.
|
|
||||||
Away mode can be used to have a second set of target temperatures (for example, while the user is
|
|
||||||
away or sleeping/at night).
|
|
||||||
|
|
||||||
- **default_target_temperature_low** (*Optional*, float): The default low target temperature for the control
|
|
||||||
algorithm when Away mode is selected. This can be dynamically set in the frontend later.
|
|
||||||
- **default_target_temperature_high** (*Optional*, float): The default high target temperature for the control
|
|
||||||
algorithm when Away mode is selected. This can be dynamically set in the frontend later.
|
|
||||||
|
|
||||||
**If configured, at least one of** ``default_target_temperature_low`` **and** ``default_target_temperature_high``
|
|
||||||
**must be specified in the away mode configuration.**
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
**away_config** is deprecated and will be removed in a future release. You should migrate your configuration
|
|
||||||
to using a :ref:`preset <thermostat-preset>` which allows for more flexibility and customisation
|
|
||||||
|
|
||||||
.. _thermostat-preset:
|
.. _thermostat-preset:
|
||||||
|
|
||||||
@ -422,6 +417,67 @@ experience and automation.
|
|||||||
preset_change:
|
preset_change:
|
||||||
- logger.log: Preset has been changed!
|
- logger.log: Preset has been changed!
|
||||||
|
|
||||||
|
Default Preset
|
||||||
|
**************
|
||||||
|
|
||||||
|
These configuration items determine default values the thermostat controller should use when it starts.
|
||||||
|
|
||||||
|
- **default_preset** (*Optional*, string): The name of the preset to use by default. Must match a preset
|
||||||
|
as per :ref:`preset <thermostat-preset>`.
|
||||||
|
- **on_boot_restore_from**: (*Optional*, on_boot_restore_from): Controls what the thermostat will do when
|
||||||
|
it first boots. One of:
|
||||||
|
|
||||||
|
- ``memory`` (default): The thermostat will restore any settings from last time it was running.
|
||||||
|
- ``default_preset``: The thermostat will always switch to the preset specified by **default_preset**
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
You can specify a ``default_preset`` and set ``on_boot_restore_from`` to ``memory``. In this mode when
|
||||||
|
the settings from last boot cannot be retrieved, for any reason, then the specified ``default_preset``
|
||||||
|
will be applied.
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
# This climate controller, on first boot, will switch to "My Startup Preset". Subsequent boots would
|
||||||
|
# restore to whatever mode it was in prior to the reboot
|
||||||
|
climate:
|
||||||
|
- platform: thermostat
|
||||||
|
name: "From Memory Thermostat"
|
||||||
|
default_preset: My Startup Preset
|
||||||
|
on_boot_restore_from: memory
|
||||||
|
preset:
|
||||||
|
- name: My Startup Preset
|
||||||
|
default_target_temperature_low: 17
|
||||||
|
default_target_temperature_high: 26
|
||||||
|
fan_mode: OFF
|
||||||
|
swing_mode: OFF
|
||||||
|
mode: OFF
|
||||||
|
# Custom preset
|
||||||
|
- name: A custom preset
|
||||||
|
default_target_temperature_low: 21
|
||||||
|
default_target_temperature_high: 23
|
||||||
|
fan_mode: HIGH
|
||||||
|
mode: HEAT_COOL
|
||||||
|
|
||||||
|
# This climate controller will always switch to "Every Start Preset"
|
||||||
|
climate:
|
||||||
|
- platform: thermostat
|
||||||
|
name: "Default Preset Thermostat"
|
||||||
|
default_preset: Every Start Preset
|
||||||
|
on_boot_restore_from: default_preset
|
||||||
|
preset:
|
||||||
|
- name: Every Start Preset
|
||||||
|
default_target_temperature_low: 17
|
||||||
|
default_target_temperature_high: 26
|
||||||
|
fan_mode: OFF
|
||||||
|
swing_mode: OFF
|
||||||
|
mode: OFF
|
||||||
|
# Custom preset
|
||||||
|
- name: A custom preset
|
||||||
|
default_target_temperature_low: 21
|
||||||
|
default_target_temperature_high: 23
|
||||||
|
fan_mode: HIGH
|
||||||
|
mode: HEAT_COOL
|
||||||
|
|
||||||
Additional Actions/Behavior
|
Additional Actions/Behavior
|
||||||
***************************
|
***************************
|
||||||
|
@ -63,7 +63,7 @@ Configuration variables:
|
|||||||
- ``Adafruit RR 280x240`` (round-rectangular display -- some pixels are "deleted" from corners to form rounded shape)
|
- ``Adafruit RR 280x240`` (round-rectangular display -- some pixels are "deleted" from corners to form rounded shape)
|
||||||
- ``Custom`` (see details below)
|
- ``Custom`` (see details below)
|
||||||
|
|
||||||
- **cs_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The CS pin.
|
- **cs_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The CS pin.
|
||||||
- **dc_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The DC pin.
|
- **dc_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The DC pin.
|
||||||
- **reset_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The RESET pin.
|
- **reset_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The RESET pin.
|
||||||
- **height** (*Optional*, int): When ``model`` is set to "Custom", use this to specify the ``height`` of the display
|
- **height** (*Optional*, int): When ``model`` is set to "Custom", use this to specify the ``height`` of the display
|
||||||
|
@ -50,6 +50,8 @@ Advanced options:
|
|||||||
|
|
||||||
- **name** (**Required**, string): Name of the project
|
- **name** (**Required**, string): Name of the project
|
||||||
- **version** (**Required**, string): Version of the project
|
- **version** (**Required**, string): Version of the project
|
||||||
|
- **min_version** (*Optional*, string): The minimum ESPHome version required to compile this configuration.
|
||||||
|
See :ref:`esphome-min_version`.
|
||||||
|
|
||||||
Old-style platform options, which have been moved to the platform-specific :doc:`esp32 </components/esp32>` and
|
Old-style platform options, which have been moved to the platform-specific :doc:`esp32 </components/esp32>` and
|
||||||
:doc:`esp8266 </components/esp8266>` sections but are still accepted here for compatibility reasons (usage not
|
:doc:`esp8266 </components/esp8266>` sections but are still accepted here for compatibility reasons (usage not
|
||||||
@ -337,6 +339,14 @@ should be ``author_name.project_name``.
|
|||||||
name: "jesse.leds_party"
|
name: "jesse.leds_party"
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
|
|
||||||
|
.. _esphome-min_version:
|
||||||
|
|
||||||
|
Minimum ESPHome version
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
This allows YAML files to specify the minimum version of ESPHome required to compile.
|
||||||
|
This is useful in the case of packages where a published package might use features only
|
||||||
|
available in a newer version of ESPHome. This allows for a more friendly error message.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
@ -6,7 +6,7 @@ BLE Client Sensor
|
|||||||
:image: bluetooth.svg
|
:image: bluetooth.svg
|
||||||
|
|
||||||
The ``ble_client`` component is a sensor platform that can
|
The ``ble_client`` component is a sensor platform that can
|
||||||
query BLE devices for specific values of service characteristics.
|
query BLE devices for RSSI or specific values of service characteristics.
|
||||||
|
|
||||||
For more information on BLE services and characteristics, see
|
For more information on BLE services and characteristics, see
|
||||||
:doc:`/components/ble_client`.
|
:doc:`/components/ble_client`.
|
||||||
@ -21,6 +21,7 @@ For more information on BLE services and characteristics, see
|
|||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: ble_client
|
- platform: ble_client
|
||||||
|
type: characteristic
|
||||||
ble_client_id: itag_black
|
ble_client_id: itag_black
|
||||||
name: "iTag battery level"
|
name: "iTag battery level"
|
||||||
service_uuid: '180f'
|
service_uuid: '180f'
|
||||||
@ -28,20 +29,34 @@ For more information on BLE services and characteristics, see
|
|||||||
icon: 'mdi:battery'
|
icon: 'mdi:battery'
|
||||||
unit_of_measurement: '%'
|
unit_of_measurement: '%'
|
||||||
|
|
||||||
|
- platform: ble_client
|
||||||
|
type: rssi
|
||||||
|
ble_client_id: itag_black
|
||||||
|
name: "iTag RSSI"
|
||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
- **ble_client_id** (**Required**, :ref:`config-id`): ID of the associated BLE client.
|
- **type** (**Required**): One of ``rssi``, ``characteristic``.
|
||||||
- **service_uuid** (**Required**, UUID): UUID of the service on the device.
|
|
||||||
- **characteristic_uuid** (**Required**, UUID): UUID of the service's characteristic to query.
|
rssi options:
|
||||||
- **descriptor_uuid** (*Optional*, UUID): UUID of the characteristic's descriptor to query.
|
|
||||||
- **id** (*Optional*, :ref:`config-id`): The ID to use for code generation, and for reference by dependent components.
|
- **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device.
|
||||||
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for converting a raw data
|
- All other options from :ref:`Sensor <config-sensor>`.
|
||||||
|
|
||||||
|
characteristic options:
|
||||||
|
|
||||||
|
- **ble_client_id** (**Required**, :ref:`config-id`): ID of the associated BLE client.
|
||||||
|
- **service_uuid** (**Required**, UUID): UUID of the service on the device.
|
||||||
|
- **characteristic_uuid** (**Required**, UUID): UUID of the service's characteristic to query.
|
||||||
|
- **descriptor_uuid** (*Optional*, UUID): UUID of the characteristic's descriptor to query.
|
||||||
|
- **id** (*Optional*, :ref:`config-id`): The ID to use for code generation, and for reference by dependent components.
|
||||||
|
- **lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for converting a raw data
|
||||||
reading to a sensor value. See :ref:`ble-sensor-lambda` for more information.
|
reading to a sensor value. See :ref:`ble-sensor-lambda` for more information.
|
||||||
- **notify** (*Optional*, boolean): Instruct the server to send notifications for this
|
- **notify** (*Optional*, boolean): Instruct the server to send notifications for this
|
||||||
characteristic.
|
characteristic.
|
||||||
- **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device.
|
- **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device.
|
||||||
- All other options from :ref:`Sensor <config-sensor>`.
|
- All other options from :ref:`Sensor <config-sensor>`.
|
||||||
|
|
||||||
Automations:
|
Automations:
|
||||||
|
|
||||||
@ -64,6 +79,7 @@ variable ``x`` of type ``std::vector<uint8_t>``. The function must return a sing
|
|||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: ble_client
|
- platform: ble_client
|
||||||
|
type: characteristic
|
||||||
ble_client_id: t_sensor
|
ble_client_id: t_sensor
|
||||||
name: "Temperature Sensor 32bit float"
|
name: "Temperature Sensor 32bit float"
|
||||||
...
|
...
|
||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -80,7 +80,7 @@ See Also
|
|||||||
- :ref:`Binary Sensor Filters <binary_sensor-filters>`
|
- :ref:`Binary Sensor Filters <binary_sensor-filters>`
|
||||||
- :doc:`Inkplate 6 Plus </components/display/inkplate6>`
|
- :doc:`Inkplate 6 Plus </components/display/inkplate6>`
|
||||||
- :doc:`EKTF2232 </components/touchscreen/ektf2232>`
|
- :doc:`EKTF2232 </components/touchscreen/ektf2232>`
|
||||||
- :doc:`XPT2046 </components/binary_sensor/xpt2046>`
|
- :doc:`XPT2046 </components/touchscreen/xpt2046>`
|
||||||
- :apiref:`touchscreen/touchscreen.h`
|
- :apiref:`touchscreen/touchscreen.h`
|
||||||
- :apiref:`touchscreen/binary_sensor/touchscreen_binary_sensor.h`
|
- :apiref:`touchscreen/binary_sensor/touchscreen_binary_sensor.h`
|
||||||
- :ghedit:`Edit`
|
- :ghedit:`Edit`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
XPT2046 Touch Screen Controller
|
XPT2046 Touch Screen Controller (Updated version)
|
||||||
==================================
|
==================================================
|
||||||
|
|
||||||
.. seo::
|
.. seo::
|
||||||
:description: Instructions for setting up XPT2046 touch screen controller with ESPHome
|
:description: Instructions for setting up XPT2046 touch screen controller with ESPHome
|
||||||
@ -8,10 +8,7 @@ XPT2046 Touch Screen Controller
|
|||||||
|
|
||||||
.. _xpt2046-component:
|
.. _xpt2046-component:
|
||||||
|
|
||||||
Component/Hub
|
The ``xpt2046`` touchscreen platform allows using the touch screen controllers
|
||||||
-------------
|
|
||||||
|
|
||||||
The ``xpt2046`` component allows using the touch screen controllers
|
|
||||||
based on the XPT2046 chip
|
based on the XPT2046 chip
|
||||||
(`datasheet <https://datasheetspdf.com/pdf-file/746665/XPTEK/XPT2046/1>`__,
|
(`datasheet <https://datasheetspdf.com/pdf-file/746665/XPTEK/XPT2046/1>`__,
|
||||||
`AZ-Delivery`_) with ESPHome. Many cheap LCD displays contain this controller.
|
`AZ-Delivery`_) with ESPHome. Many cheap LCD displays contain this controller.
|
||||||
@ -28,32 +25,20 @@ The :ref:`SPI <spi>` is required to be set up in your configuration for this sen
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
# Example configuration entry
|
# Example configuration entry
|
||||||
xpt2046:
|
touchscreen:
|
||||||
|
platform: xpt2046
|
||||||
id: touchscreen
|
id: touchscreen
|
||||||
cs_pin: 17
|
cs_pin: 17
|
||||||
irq_pin: 16
|
interupt_pin: 16
|
||||||
update_interval: 50ms
|
update_interval: 50ms
|
||||||
report_interval: 1s
|
report_interval: 1s
|
||||||
threshold: 400
|
threshold: 400
|
||||||
dimension_x: 240
|
|
||||||
dimension_y: 320
|
|
||||||
calibration_x_min: 3860
|
calibration_x_min: 3860
|
||||||
calibration_x_max: 280
|
calibration_x_max: 280
|
||||||
calibration_y_min: 340
|
calibration_y_min: 340
|
||||||
calibration_y_max: 3860
|
calibration_y_max: 3860
|
||||||
swap_x_y: false
|
swap_x_y: false
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: xpt2046
|
|
||||||
xpt2046_id: touchscreen
|
|
||||||
id: touch_key0
|
|
||||||
x_min: 80
|
|
||||||
x_max: 160
|
|
||||||
y_min: 106
|
|
||||||
y_max: 212
|
|
||||||
on_state:
|
|
||||||
- lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));'
|
|
||||||
|
|
||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
------------------------
|
------------------------
|
||||||
@ -66,12 +51,12 @@ Base Configuration:
|
|||||||
- **cs_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The chip select pin.
|
- **cs_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The chip select pin.
|
||||||
Often marked ``T_CS`` on the board.
|
Often marked ``T_CS`` on the board.
|
||||||
|
|
||||||
- **irq_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin.
|
- **interupt_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin.
|
||||||
Often marked ``T_IRQ`` on the board. If not specified the component will use polling
|
Often marked ``T_IRQ`` on the board. If not specified the component will use polling
|
||||||
via SPI.
|
via SPI. This key is renamed from **irq_pin**
|
||||||
|
|
||||||
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
|
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
|
||||||
sensor. If ``irq_pin`` is specified the touch will be detected nearly instantaneously and this setting
|
sensor. If ``interupt_pin`` is specified the touch will be detected nearly instantaneously and this setting
|
||||||
will be used only for the release detection. Defaults to ``50ms``.
|
will be used only for the release detection. Defaults to ``50ms``.
|
||||||
|
|
||||||
- **report_interval** (*Optional*, :ref:`config-time`): The interval to periodically
|
- **report_interval** (*Optional*, :ref:`config-time`): The interval to periodically
|
||||||
@ -79,12 +64,6 @@ Base Configuration:
|
|||||||
|
|
||||||
- **threshold** (*Optional*, int): The value to detect the touch or release. Defaults to ``400``.
|
- **threshold** (*Optional*, int): The value to detect the touch or release. Defaults to ``400``.
|
||||||
|
|
||||||
- **dimension_x** (*Optional*, int): The dimension of the display in the horizontal
|
|
||||||
direction. Usually in pixels but a percentage can be useful as well. Defaults to ``100``.
|
|
||||||
|
|
||||||
- **dimension_y** (*Optional*, int): The dimension of the display in the vertical
|
|
||||||
direction. Usually in pixels but a percentage can be useful as well. Defaults to ``100``.
|
|
||||||
|
|
||||||
- **calibration_x_min** (*Optional*, int): The raw value corresponding to the left
|
- **calibration_x_min** (*Optional*, int): The raw value corresponding to the left
|
||||||
(or top if ``swap_x_y`` is specified) edge of the display. See :ref:`xpt2046-calibration`
|
(or top if ``swap_x_y`` is specified) edge of the display. See :ref:`xpt2046-calibration`
|
||||||
for the process to calibrate the touch screen. Defaults to ``0``.
|
for the process to calibrate the touch screen. Defaults to ``0``.
|
||||||
@ -100,65 +79,8 @@ Base Configuration:
|
|||||||
|
|
||||||
- **swap_x_y** (*Optional*, boolean): If true the x and y axes are swapped. Defaults to ``false``.
|
- **swap_x_y** (*Optional*, boolean): If true the x and y axes are swapped. Defaults to ``false``.
|
||||||
|
|
||||||
- **on_state** (*Optional*, :ref:`Automation <automation>`): An automation to perform
|
- All other options from :ref:`config-touchscreen`.
|
||||||
when the touch screen is pressed or released. See :ref:`xpt2046-on_state`.
|
|
||||||
|
|
||||||
.. _xpt2046-on_state:
|
|
||||||
|
|
||||||
``on_state`` Action
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
This automation will be triggered when the XPT2046 touch screen detects a touch, a release
|
|
||||||
or periodically each ``report_interval`` while touched.
|
|
||||||
|
|
||||||
This trigger provides three arguments: ``x`` and ``y`` are of the type int and specify the
|
|
||||||
coordinates of the touch and a bool ``touched`` specifying whether a touch or release was
|
|
||||||
detected.
|
|
||||||
|
|
||||||
Additionally to the coordinates, the touch status and the raw values needed for the calibration
|
|
||||||
can be accessed as member variables.
|
|
||||||
|
|
||||||
The following code
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
xpt2046:
|
|
||||||
on_state:
|
|
||||||
- lambda: |-
|
|
||||||
ESP_LOGI("main", "args x=%d, y=%d, touched=%s", x, y, (touched ? "touch" : "release"));
|
|
||||||
ESP_LOGI("main", "member x=%d, y=%d, touched=%d, x_raw=%d, y_raw=%d, z_raw=%d",
|
|
||||||
id(touchscreen).x,
|
|
||||||
id(touchscreen).y,
|
|
||||||
(int) id(touchscreen).touched,
|
|
||||||
id(touchscreen).x_raw,
|
|
||||||
id(touchscreen).y_raw,
|
|
||||||
id(touchscreen).z_raw
|
|
||||||
);
|
|
||||||
|
|
||||||
produces
|
|
||||||
|
|
||||||
.. code-block:: none
|
|
||||||
|
|
||||||
[20:17:37][I][main:065]: args x=145, y=261, touched=touch
|
|
||||||
[20:17:37][I][main:073]: member x=145, y=261, touched=1, x_raw=1686, y_raw=3218, z_raw=424
|
|
||||||
[20:17:37][I][main:065]: args x=145, y=261, touched=release
|
|
||||||
[20:17:37][I][main:073]: member x=145, y=261, touched=0, x_raw=0, y_raw=0, z_raw=0
|
|
||||||
|
|
||||||
Binary Sensor
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The ``xpt2046`` binary sensor allows you to setup areas on the touch screen as virtual
|
|
||||||
buttons. First, setup a :ref:`xpt2046-component` and then use this binary sensor platform
|
|
||||||
to create individual binary sensors for each virtual button.
|
|
||||||
|
|
||||||
- **name** (*Optional*, string): The name for the binary sensor.
|
|
||||||
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
|
|
||||||
- **xpt2046_id** (*Optional*, :ref:`config-id`): Specify the ID of the component the sensor is part of. Useful when you have more than one touch screen.
|
|
||||||
- **x_min** (**Required**, int): Left coordinate of the screen area to be detected as the virtual button.
|
|
||||||
- **x_max** (**Required**, int): Right coordinate of the screen area to be detected as the virtual button.
|
|
||||||
- **y_min** (**Required**, int): Top coordinate of the screen area to be detected as the virtual button.
|
|
||||||
- **y_max** (**Required**, int): Bottom coordinate of the screen area to be detected as the virtual button.
|
|
||||||
- All other options from :ref:`Binary Sensor <config-binary_sensor>`.
|
|
||||||
|
|
||||||
.. _xpt2046-calibration:
|
.. _xpt2046-calibration:
|
||||||
|
|
||||||
@ -168,7 +90,7 @@ Calibration
|
|||||||
To match the point of the touch to the display coordinates the touch screen has to be calibrated.
|
To match the point of the touch to the display coordinates the touch screen has to be calibrated.
|
||||||
The XPT2046 component returns raw values in the 0 to 4095 range. Those raw values are available
|
The XPT2046 component returns raw values in the 0 to 4095 range. Those raw values are available
|
||||||
as the ``x_raw`` and ``y_raw`` member variables and for example write them out as in the example
|
as the ``x_raw`` and ``y_raw`` member variables and for example write them out as in the example
|
||||||
:ref:`xpt2046-on_state`. The goal of the calibration is to identify the raw values corresponding
|
:ref:`touchscreen-on_touch`. The goal of the calibration is to identify the raw values corresponding
|
||||||
to the edges of the screen.
|
to the edges of the screen.
|
||||||
|
|
||||||
The calibration assumes a display oriented in a way that you will be using it, i.e. your
|
The calibration assumes a display oriented in a way that you will be using it, i.e. your
|
||||||
@ -179,16 +101,13 @@ values nor ``swap_x_y``.
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
# Touchscreen
|
# Touchscreen
|
||||||
xpt2046:
|
touchscreen:
|
||||||
|
platform: xpt2046
|
||||||
id: touchscreen
|
id: touchscreen
|
||||||
cs_pin: 17
|
cs_pin: 17
|
||||||
irq_pin: 16
|
on_touch:
|
||||||
dimension_x: 240
|
|
||||||
dimension_y: 320
|
|
||||||
on_state:
|
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (touched)
|
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
|
||||||
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%d",
|
|
||||||
id(touchscreen).x,
|
id(touchscreen).x,
|
||||||
id(touchscreen).y,
|
id(touchscreen).y,
|
||||||
id(touchscreen).x_raw,
|
id(touchscreen).x_raw,
|
||||||
@ -230,7 +149,8 @@ The vertical direction is fine. The configuration would thus be
|
|||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
xpt2046:
|
touchscreen:
|
||||||
|
platform: xpt2046
|
||||||
calibration_x_min: 3848
|
calibration_x_min: 3848
|
||||||
calibration_x_max: 281
|
calibration_x_max: 281
|
||||||
calibration_y_min: 347
|
calibration_y_min: 347
|
||||||
@ -250,7 +170,7 @@ Note that the touch screen is not extremely precise and there might be nonlinear
|
|||||||
or similar errors so don't expect a pixel-perfect precision. You can verify the touchpoint
|
or similar errors so don't expect a pixel-perfect precision. You can verify the touchpoint
|
||||||
using a display lambda similar to the following.
|
using a display lambda similar to the following.
|
||||||
|
|
||||||
.. code-block:: none
|
.. code-block:: yaml
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: ili9341
|
- platform: ili9341
|
4
conf.py
4
conf.py
@ -66,9 +66,9 @@ author = "ESPHome"
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = "2022.9"
|
version = "2022.10"
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = "2022.9.4"
|
release = "2022.10.0-dev"
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -55,6 +55,7 @@ Configuration example:
|
|||||||
# a notification is received, the corresponding binary_sensor
|
# a notification is received, the corresponding binary_sensor
|
||||||
# is briefly toggled.
|
# is briefly toggled.
|
||||||
- platform: ble_client
|
- platform: ble_client
|
||||||
|
type: characteristic
|
||||||
ble_client_id: itag_black
|
ble_client_id: itag_black
|
||||||
name: "Black iTag btn"
|
name: "Black iTag btn"
|
||||||
service_uuid: 'ffe0'
|
service_uuid: 'ffe0'
|
||||||
@ -73,12 +74,18 @@ Configuration example:
|
|||||||
# support this characteristic, you will see 'Unknown' in the
|
# support this characteristic, you will see 'Unknown' in the
|
||||||
# HA frontend.
|
# HA frontend.
|
||||||
- platform: ble_client
|
- platform: ble_client
|
||||||
|
type: characteristic
|
||||||
ble_client_id: itag_black
|
ble_client_id: itag_black
|
||||||
name: "Black iTag Battery"
|
name: "Black iTag Battery"
|
||||||
service_uuid: '180f'
|
service_uuid: '180f'
|
||||||
characteristic_uuid: '2a19'
|
characteristic_uuid: '2a19'
|
||||||
icon: 'mdi:battery'
|
icon: 'mdi:battery'
|
||||||
unit_of_measurement: '%'
|
unit_of_measurement: '%'
|
||||||
|
# This entry queries polls the RSSI when the tag is connected.
|
||||||
|
- platform: ble_client
|
||||||
|
type: rssi
|
||||||
|
ble_client_id: itag_black
|
||||||
|
name: "Black iTag RSSI"
|
||||||
|
|
||||||
Explanation
|
Explanation
|
||||||
-----------
|
-----------
|
||||||
|
Loading…
Reference in New Issue
Block a user