From 9eee18eb6df90b495664bdb2b84e6f70d5169c7c Mon Sep 17 00:00:00 2001 From: Kevin Ahrendt Date: Mon, 28 Oct 2024 16:10:56 -0400 Subject: [PATCH 01/11] [media_player] add new conditions to all conditions list (#4396) --- automations/all_conditions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automations/all_conditions.rst b/automations/all_conditions.rst index 2b55ebdd6b..cf945e57f2 100644 --- a/automations/all_conditions.rst +++ b/automations/all_conditions.rst @@ -8,7 +8,7 @@ - **fan:** ``is_off``, ``is_on`` - **light:** ``is_off``, ``is_on`` - **lock:** ``is_locked``, ``is_unlocked`` -- **media_player:** ``is_idle``, ``is_playing`` +- **media_player:** ``is_announcing``, ``is_idle``, ``is_paused``, ``is_playing`` - **micro_wake_word:** ``is_running`` - **microphone:** ``is_capturing`` - **mqtt:** ``connected`` From c8416074fcec70519c51f5c1c6bced4c0b34d777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20=C3=81rkosi=20R=C3=B3bert?= Date: Mon, 28 Oct 2024 23:05:54 +0100 Subject: [PATCH 02/11] add `qrcode` lvgl widget (#4347) --- components/lvgl/widgets.rst | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/components/lvgl/widgets.rst b/components/lvgl/widgets.rst index 47631bbc10..f58725b83b 100644 --- a/components/lvgl/widgets.rst +++ b/components/lvgl/widgets.rst @@ -1248,6 +1248,50 @@ You can use it as a parent container for other widgets. By default, it catches t widgets: - ... +.. _lvgl-widget-qrcode: + +``qrcode`` +---------- + +Use this widget to generate and display a QR-code containing a string at run time. + +**Configuration variables:** + +- **text** (**Required**, string): The string to be encoded in the QR. +- **size** (**Required**, int16): Set the desired size of the QR-code (in pixels). QR-codes with less data are smaller, but they scaled by an integer number to best fit to the given size. +- **light_color** (*Optional*, :ref:`color `): Color for the light areas of the QR. Defaults to white. +- **dark_color** (*Optional*, :ref:`color `): Color for the dark areas of the QR. Defaults to black. +- Style options from :ref:`lvgl-styling`. + +**Actions:** + +- ``lvgl.qrcode.update`` :ref:`action ` updates the widget's ``text`` property to display a new QR-code. + - **id** (**Required**): The ID of the qrcode widget to be updated. + - **text** (**Required**): The new text to be encoded and displayed. + +**Triggers:** + +- :ref:`interaction ` LVGL event triggers. + +**Example:** + +.. code-block:: yaml + + # Example widget: + - qrcode: + id: lv_qr + size: 100 + light_color: whitesmoke + dark_color: steelblue + text: esphome.io + + # Example action: + on_...: + then: + - lvgl.qrcode.update: + id: lv_qr + text: home-assistant.io + .. _lvgl-widget-roller: ``roller`` From cbb2ba8a27357d84276aa6f4a5de52f80ddc7c70 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:23:38 +1100 Subject: [PATCH 03/11] [http_request] Add status_code note (#4397) --- components/http_request.rst | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/components/http_request.rst b/components/http_request.rst index 54e1dc803e..1acaa76583 100644 --- a/components/http_request.rst +++ b/components/http_request.rst @@ -166,6 +166,11 @@ The following variables are available for use in :ref:`lambdas `: - ``body`` as ``std::string`` which contains the response body when ``capture_response`` (see :ref:`http_request-get_action`) is set to ``true``. + .. note:: + + The ``status_code`` should be checked before using the ``body`` variable. A successful response will usually have + a status code of ``200``. Server errors such as "not found" (404) or "internal server error" (500) will have an appropriate status code, and may contain an error message in the ``body`` variable. + .. code-block:: yaml on_... @@ -261,11 +266,19 @@ whose ``id`` is set to ``player_volume``: capture_response: true on_response: then: - - lambda: |- - json::parse_json(body, [](JsonObject root) -> bool { - id(player_volume).publish_state(root["vol"]); - return true; - }); + - if: + condition: + lambda: return response->status_code == 200; + then: + - lambda: |- + json::parse_json(body, [](JsonObject root) -> bool { + id(player_volume).publish_state(root["vol"]); + return true; + }); + else: + - logger.log: + format: "Error: Response status: %d, message %s" + args: [response->status_code, body.c_str()]; See Also From 3c1775697ea73d551e6bef2f063fd363b63e9ee1 Mon Sep 17 00:00:00 2001 From: Satoshi YAMADA Date: Tue, 29 Oct 2024 12:08:12 +0900 Subject: [PATCH 04/11] Add polling_interval and its usage to ethernet.rst (#4389) --- components/ethernet.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/components/ethernet.rst b/components/ethernet.rst index bc2a5b4def..f5e1258744 100644 --- a/components/ethernet.rst +++ b/components/ethernet.rst @@ -90,11 +90,30 @@ SPI configuration variables: - **miso_pin** (**Required**, :ref:`config-pin`): The SPI MISO pin. - **cs_pin** (**Required**, :ref:`config-pin`): The SPI chip select pin. - **interrupt_pin** (*Optional*, :ref:`config-pin`): The interrupt pin. + This variable is **required** for older frameworks. See below. - **reset_pin** (*Optional*, :ref:`config-pin`): The reset pin. - **clock_speed** (*Optional*, float): The SPI clock speed. Any frequency between `8Mhz` and `80Mhz` is allowed, but the nearest integer division of `80Mhz` is used, i.e. `16Mhz` (`80Mhz` / 5) is used when `15Mhz` is configured. Default: `26.67Mhz`. +- **polling_interval** (*Optional*, :ref:`config-time`): If ``interrupt_pin`` is not set, + set the time interval for periodic polling. Minimum is 1ms, Defaults to 10ms. + Older frameworks may not support this variable. See below for details. + +If you are using a framework with the latest version, ESPHome provides +an SPI-based Ethernet module without interrupt pin. +Support for SPI polling mode (no interrupt pin) is provided by the following frameworks: + +- ESP-IDF 5.3 or later +- ESP-IDF 5.2.1 and later 5.2.x versions +- ESP-IDF 5.1.4 +- Arduino-ESP32 3.0.0 or later (**Caution**: PlatformIO does not support these Arduino-ESP32 versions) + +When building with frameworks that support SPI polling mode, either ``interrupt_pin`` +or ``polling_interval`` can be set. If you set both, ESPHome will throw an error. + +If you are using a framework that does not support SPI-based ethernet modules without interrupt pin, +``interrupt_pin`` is **required** and you cannot set ``polling_interval``. Advanced common configuration variables: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From eebdac18256a42ff7d5e61697e44bb2e90c611fd Mon Sep 17 00:00:00 2001 From: Sean Brogan Date: Mon, 28 Oct 2024 20:49:09 -0700 Subject: [PATCH 05/11] Update Mopeka docs to include new optional sensors and configuration (#4281) --- components/sensor/mopeka_pro_check.rst | 42 +++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/components/sensor/mopeka_pro_check.rst b/components/sensor/mopeka_pro_check.rst index 6647cb0c2c..7071d140bc 100644 --- a/components/sensor/mopeka_pro_check.rst +++ b/components/sensor/mopeka_pro_check.rst @@ -9,8 +9,9 @@ Mopeka Pro Check BLE Sensor The ``mopeka_pro_check`` sensor platform lets you track the output of Mopeka Pro Check LP, Mopeka Pro Plus, Mopeka Pro Universal or Lippert Propane Tank Sensors, Bluetooth Low Energy devices using the :doc:`/components/esp32_ble_tracker`. This component -will track the tank level, distance, temperature, and battery percentage of a -device every time the sensor sends out a BLE broadcast. +will track the tank level, distance, temperature, battery percentage, and sensor reading quality of a +device every time the sensor sends out a BLE broadcast. There are additional configuration options +to control handling of poor quality readings and reporting reading quality issues. .. warning:: @@ -56,6 +57,12 @@ Mopeka Pro Check LP over BLE: name: "Propane test distance" battery_level: name: "Propane test battery level" + signal_quality: + name: "Propane test read quality" + ignored_reads: + name: "Propane test ignored reads" + # Report sensor distance/level data for all equal or greater than + minimum_signal_quality: "LOW" # Custom example - user defined empty / full points - platform: mopeka_pro_check @@ -87,11 +94,13 @@ Configuration variables: - **custom_distance_empty** (*Optional*): distance sensor will read when it should be considered empty (0%). This is only used when tank_type = CUSTOM -- **level** (*Optional*): The percentage of full for the tank sensor +- **level** (*Optional*): The percentage of full for the tank sensor. If + read is ignored due to quality this sensor will not be updated. - All options from :ref:`Sensor `. - **distance** (*Optional*): The raw distance/depth of the liquid for the sensor in mm. + If read is ignored due to quality this sensor will not be updated. - All options from :ref:`Sensor `. @@ -105,6 +114,31 @@ Configuration variables: - All options from :ref:`Sensor `. +- **signal_quality** (*Optional*): The information for the read quality + sensor. + + - All options from :ref:`Sensor `. + +- **ignored_reads** (*Optional*): A diagnostic sensor indicating the number + of consecutive ignored reads. This resets to zero each time the read is + equal or greater than the configured ignored quality. Only the distance + and level sensors are not reported. + + - All options from :ref:`Sensor `. + +- **minimum_signal_quality** (*Optional*): Each report from the sensor + indicates the quality or confidence in the distance the sensor calculated. Physical + sensor placement, tank material or quality, or other factors can influence the + sensors ability to read with confidence. As quality gets lower, the accuracy of the + distance reading may not align with expectations. This value allows configuration of + the minimum quality level that the distance should be evaluated/reported. + Acceptable Values: + + - "HIGH": High Quality + - "MEDIUM": Medium Quality (default value) + - "LOW": Low Quality + - "ZERO": Zero Quality + Tank Types ---------- @@ -132,7 +166,7 @@ and the ``mopeka_ble`` component like so: mopeka_ble: After uploading, the ESP32 will immediately try to scan for BLE devices. Press and hold the sync button for it to be identified. -Or alternativly set the configuration flag ``show_sensors_without_sync: true`` to see all devices. +Or alternatively set the configuration flag ``show_sensors_without_sync: true`` to see all devices. For all sensors found the ``mopeka_ble`` component will print a message like this one: .. code:: From 07b045375d7262cbdf0c3e230e605c48e613bb5d Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Wed, 30 Oct 2024 12:11:01 +1100 Subject: [PATCH 06/11] [http_request] Document on_error trigger (#4401) --- components/http_request.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/http_request.rst b/components/http_request.rst index 1acaa76583..4b599bbc78 100644 --- a/components/http_request.rst +++ b/components/http_request.rst @@ -105,6 +105,7 @@ This :ref:`action ` sends a GET request. - **max_response_buffer_size** (*Optional*, integer): The maximum buffer size to be used to store the response. Defaults to ``1 kB``. - **on_response** (*Optional*, :ref:`Automation `): An automation to perform after the request is received. +- **on_error** (*Optional*, :ref:`Automation `): An automation to perform if the request cannot be completed. .. _http_request-post_action: @@ -186,6 +187,20 @@ The following variables are available for use in :ref:`lambdas `: - response->duration_ms - lambda: |- ESP_LOGD(TAG, "Response status: %d, Duration: %u ms", response->status_code, response->duration_ms); + on_error: + then: + - logger.log: "Request failed!" + + +.. _http_request-on_error: + +``on_error`` Trigger +----------------------- + +This automation will be triggered when the HTTP request fails to complete. This may be e.g. when the network is not available, +or the server is not reachable. This will *not* be triggered if the request +completes, even if the response code is not 200. No information on the type of error is available and no variables +are available for use in :ref:`lambdas `. See example usage above. .. _http_request-examples: From a10eaddf2258485918139a10f0cdb3b56b4b1f11 Mon Sep 17 00:00:00 2001 From: Kevin Ahrendt Date: Wed, 30 Oct 2024 15:29:28 -0400 Subject: [PATCH 07/11] [es8311]] Document new ES8311 component (#4400) --- components/audio_dac/es8311.rst | 81 +++++++++++++++++++++++++++++++++ images/es8311.svg | 1 + index.rst | 1 + 3 files changed, 83 insertions(+) create mode 100644 components/audio_dac/es8311.rst create mode 100644 images/es8311.svg diff --git a/components/audio_dac/es8311.rst b/components/audio_dac/es8311.rst new file mode 100644 index 0000000000..c7a9d67451 --- /dev/null +++ b/components/audio_dac/es8311.rst @@ -0,0 +1,81 @@ +ES8311 +====== + +.. seo:: + :description: Instructions for using ESPHome's ES8311 audio DAC platform to play media from your devices. + :image: es8311.svg + :keywords: ES8311, Audio, DAC, I2S, ESP32 + +The ``es8311`` platform allows your ESPHome devices to use the ES8311 low power mono audio codec. +This allows the playback of audio via the microcontroller from a range of sources via :doc:`/components/speaker/index` or +:doc:`/components/media_player/index`. + +The :ref:`I²C bus ` is required in your configuration as this is used to communicate with the ES8311. + +.. code-block:: yaml + + # Example configuration entry + audio_dac: + - platform: es8311 + +.. _config-es8311: + +Configuration variables: +------------------------ +- **bits_per_sample** (*Optional*, enum): The bit depth of the audio samples. One of ``16bit``, ``24bit``, or ``32bit``. Defaults to ``16bit``. +- **sample_rate** (*Optional*, positive integer): I2S sample rate. Defaults to ``16000``. +- **use_mclk** (*Optional*, bool): Use the MCLK signal to control the clock. Defaults to ``True``. +- **use_microphone** (*Optional*, bool): Configure the codec's ADC for microphone input. Defaults to ``False``. +- **mic_gain** (*Optional*, enum): The gain applied to the ADC microphones. One of ``MIN``, ``0DB``, ``6DB``, ``12DB``, ``18DB``, ``24DB``, ``30DB``, ``36DB``, ``42DB``, or ``MAX``. Defaults to ``42DB``. +- **address** (*Optional*, int): The I²C address of the driver. Defaults to ``0x18``. +- **i2c_id** (*Optional*): The ID of the :ref:`I²C bus ` the ES8311 is connected to. +- All other options from :ref:`Audio DAC `. + +Automations +----------- + +All :ref:`Audio DAC Automations ` are supported by this platform. + +Configuration Examples +---------------------- + +**ESP32 S3 Box 3**: + +.. code-block:: yaml + + audio_dac: + - platform: es8311 + id: es8311_dac + bits_per_sample: 16bit + sample_rate: 16000 + + i2s_audio: + - id: i2s_output + i2s_lrclk_pin: GPIO45 + i2s_bclk_pin: GPIO17 + i2s_mclk_pin: GPIO23 + + speaker: + - platform: i2s_audio + i2s_audio_id: i2s_output + id: speaker_id + i2s_dout_pin: GPIO15 + dac_type: external + sample_rate: 16000 + bits_per_sample: 16bit + channel: stereo + audio_dac: es8311_dac + + switch: + - platform: gpio + name: "Speaker Enable" + pin: GPIO46 + restore_mode: RESTORE_DEFAULT_ON + +See Also +-------- + +- :doc:`index` +- :apiref:`es8311/es8311.h` +- :apiref:`audio_dac/audio_dac.h` +- :ghedit:`Edit` diff --git a/images/es8311.svg b/images/es8311.svg new file mode 100644 index 0000000000..0600c850b3 --- /dev/null +++ b/images/es8311.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.rst b/index.rst index 5ea63d0bc2..1d8ec0539f 100644 --- a/index.rst +++ b/index.rst @@ -1019,6 +1019,7 @@ Audio DAC Components Audio DAC Core, components/audio_dac/index, audio_dac.svg AIC3204, components/audio_dac/aic3204, aic3204.svg + ES8311, components/audio_dac/es8311, es8311.svg Media Player Components ----------------------- From 4f3a859315d4023463a9ecd6ab6c64296ece9a87 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:15:42 +1100 Subject: [PATCH 08/11] Document touchscreen changes (#4403) --- components/touchscreen/index.rst | 57 ++++++++++-------------------- components/touchscreen/xpt2046.rst | 32 ++++++++--------- 2 files changed, 33 insertions(+), 56 deletions(-) diff --git a/components/touchscreen/index.rst b/components/touchscreen/index.rst index bfbb2c48da..527308d864 100644 --- a/components/touchscreen/index.rst +++ b/components/touchscreen/index.rst @@ -7,16 +7,8 @@ Touchscreen Components The ``touchscreen`` component contains the base code for most touchscreen driver components available in ESPHome and is responsible for passing the touch events to -``binary_sensors`` with the ``touchscreen`` platform. +``binary_sensors`` with the ``touchscreen`` platform. It is also used by the LVGL component. -.. warning:: - - As of version **2023.12** the way how the touchscreen component has changed a bit. - The following variables are now obsolite: - * **rotation** is (temporary) removed in favor the *new* **transform:** - * **size_x_y** is moved inside the **transform:** and renamed to **size_xy** - * **report_interval** is removed in favor of using the **update_interval** - The display id is only just to calculate the touch position reletive to the displays *height* and *width* .. _config-touchscreen: @@ -33,9 +25,6 @@ Base Touchscreen Configuration mirror_x: false mirror_y: false swap_xy: false - calibration: - x_max: 240 - y_max: 320 on_touch: then: @@ -50,26 +39,26 @@ Base Touchscreen Configuration Configuration variables: ************************ - **display** (*Required*, :ref:`config-id`): The display to use this touchscreen with. -- **transform** (*Optional*): Transform the touchscreen presentation using hardware. All defaults are ``false``. +- **transform** (*Optional*): Transform the reported position to match the display. - **swap_xy** (*Optional*, boolean): If true, exchange the x and y axes. - **mirror_x** (*Optional*, boolean): If true, mirror the x axis. - **mirror_y** (*Optional*, boolean): If true, mirror the y axis. -- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the touchscreen. Defaults to ``never``. **NOTE:** Set this to ``50ms`` when you dont have set the **interupt_pin**. -- **touch_timeout** (*Optional*, :ref:`config-time`): The time to automatically check if touch was released. Defaults to ``never``. -- **calibration** (*Optional*): When the touchscreen is not given the right configuration settings. You can set them here. +- **update_interval** (*Optional*, :ref:`config-time`): The touchscreen polling interval - used only if an interrupt pin is not in use. Defaults to ``50ms``. +- **touch_timeout** (*Optional*, :ref:`config-time`): A timeout for touchscreens that do not report the end of touch. The default varies depending on the touchscreen. +- **calibration** (*Optional*): Some touchscreens require calibration on a per-device basis. - - **x_min** (*Optional*, int): The raw value corresponding to the left + - **x_min** (**Required**, int): The raw value corresponding to the left (or top if ``swap_xy`` is specified) edge of the touchscreen. See :ref:`touchscreen-calibration` - for the process to calibrate the touchscreen. Defaults to ``0``. - - **x_max** (*Optional*, int): The raw value corresponding to the right - (or bottom if ``swap_xy`` is specified) edge of the touchscreen. Defaults to ``0``. - - **y_min** (*Optional*, int): The raw value corresponding to the top - (or left if ``swap_xy`` is specified) edge of the touchscreen. Defaults to ``0``. - - **y_max** (*Optional*, int): The raw value corresponding to the bottom - (or right if ``swap_xy`` is specified) edge of the touchscreen. Defaults to ``0``. + for the process to calibrate the touchscreen. + - **x_max** (**Required**, int): The raw value corresponding to the right + (or bottom if ``swap_xy`` is specified) edge of the touchscreen. + - **y_min** (**Required**, int): The raw value corresponding to the top + (or left if ``swap_xy`` is specified) edge of the touchscreen. + - **y_max** (**Required**, int): The raw value corresponding to the bottom + (or right if ``swap_xy`` is specified) edge of the touchscreen. - **on_touch** (*Optional*, :ref:`Automation `): An automation to perform @@ -103,23 +92,18 @@ The integer members for the touch positions below are in relation to the display Calibration ----------- -For most of the touchscreen drivers the dimensions of the touchscreen are automatically set when the driver is setup. -In some cases like for the **XPT2046** this can be different per used display panel. -Then you can set the values using the **calibrate** values. +For most touchscreen drivers the dimensions of the touchscreen are automatically set from the display driver to match the screen size. +In some cases such as the :ref:`XPT2046 ` (a resistive touch screen) the reported values bear no relation to the actual screen size. +The ``calibration`` configuration can be used to manually calibrate the touchscreen. To match the point of the touch to the display coordinates the touch screen has to be calibrated. -The touchscreen 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 -:ref:`touchscreen-on_touch`. The goal of the calibration is to identify the raw values corresponding +The touchscreen component returns raw values in the calibration range. Those raw values are available +as the ``x_raw`` and ``y_raw`` member variables. The goal of the calibration is to identify the raw values corresponding to the edges of the screen. The calibration assumes a display oriented in a way that you will be using it, i.e. your :ref:`display-engine` component has to have the [0,0] logical coordinate at the top left. -.. note:: - - Do not set any calibration values nor ``transform`` settings. - .. code-block:: yaml # Touchscreen @@ -139,11 +123,6 @@ The calibration assumes a display oriented in a way that you will be using it, i Get a stylus or a similar object, run the project and touch the corners of the screen at the edge pixels. Repeat several times and note minimum and maximum x and y raw values. -.. warning:: - - As long the calibrate settings are not correctly set, the ``x`` and ``y`` coordinates are not calculated. - - .. code-block:: none ... top left ... diff --git a/components/touchscreen/xpt2046.rst b/components/touchscreen/xpt2046.rst index c89801efb5..d35f2ffa25 100644 --- a/components/touchscreen/xpt2046.rst +++ b/components/touchscreen/xpt2046.rst @@ -8,7 +8,7 @@ XPT2046 Touch Screen Controller (Updated version) .. _xpt2046-component: -The ``xpt2046`` touchscreen platform allows using the touch screen controllers +The ``xpt2046`` touchscreen platform allows using the resistive touch screen controllers based on the XPT2046 chip (`datasheet `__, `AZ-Delivery`_) with ESPHome. Many cheap LCD displays contain this controller. @@ -32,9 +32,11 @@ The :ref:`SPI ` is required to be set up in your configuration for this sen interrupt_pin: GPIOXX update_interval: 50ms threshold: 400 + transform: + mirror_x: true calibration: - x_min: 3860 - x_max: 280 + x_min: 280 + x_max: 3860 y_min: 340 y_max: 3860 @@ -45,32 +47,28 @@ The configuration is made up of two parts: The touch screen component, and optio Base Configuration: - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor. - - **cs_pin** (*Optional*, :ref:`Pin Schema `): The chip select pin. Often marked ``T_CS`` on the board. - - **interrupt_pin** (*Optional*, :ref:`Pin Schema `): The touch detection pin. Often marked ``T_IRQ`` on the board. If not specified the component will use polling via SPI. This key is renamed from **irq_pin** - - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. If ``interrupt_pin`` is specified the touch will be detected nearly instantaneously and this setting will be used only for the release detection. Defaults to ``50ms``. - - **threshold** (*Optional*, int): The value to detect the touch or release. Defaults to ``400``. +- **calibration** (**Required**): The XPT2046 is a resistive touch screen and it will require calibration on a per-device basis. + - **x_min** (**Required**, int): The raw value corresponding to the left + (or top if ``swap_xy`` is specified) edge of the touchscreen. See :ref:`touchscreen-calibration` + for the process to calibrate the touchscreen. + - **x_max** (**Required**, int): The raw value corresponding to the right + (or bottom if ``swap_xy`` is specified) edge of the touchscreen. + - **y_min** (**Required**, int): The raw value corresponding to the top + (or left if ``swap_xy`` is specified) edge of the touchscreen. + - **y_max** (**Required**, int): The raw value corresponding to the bottom + (or right if ``swap_xy`` is specified) edge of the touchscreen. -- **calibration_x_min** (*Deprecated*): This value is moved to the ``calibration`` values - -- **calibration_x_max** (*Deprecated*): This value is moved to the ``calibration`` values. - -- **calibration_y_min** (*Deprecated*): This value is moved to the ``calibration`` values. - -- **calibration_y_max** (*Deprecated*): This value is moved to the ``calibration`` values. - -- **swap_x_y** (*Deprecated*): This value is moved to the ``transform`` values as ``swap_xy`` see :ref:`config-touchscreen`. -- **report_interval** (*Deprecated*): This interval is removed in favor of the ``update_interval``. - All other options from :ref:`config-touchscreen`. From 593f745c0169128ed72c5effaf9aa4d65f3f1b2d Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Thu, 31 Oct 2024 05:36:26 +0200 Subject: [PATCH 09/11] [font] Add documentation for glyphsets (#4245) --- components/font.rst | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/components/font.rst b/components/font.rst index 1a800bdb1f..7de652a6b5 100644 --- a/components/font.rst +++ b/components/font.rst @@ -71,6 +71,16 @@ Next, create a ``font:`` section in your configuration: "\U000F05D4", # mdi-airplane-landing ] + - file: + type: gfonts + family: Roboto + id: roboto_european_core + size: 16 + glyphsets: + - GF_Latin_Core + - GF_Greek_Core + - GF_Cyrillic_Core + - file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf" id: web_font size: 20 @@ -124,9 +134,26 @@ Configuration variables: If you want to use the same font in different sizes, create two font objects. Note: *size* is ignored by bitmap fonts. Defaults to ``20``. - **bpp** (*Optional*, int): The bit depth of the rendered font from OpenType/TrueType, for anti-aliasing. Can be ``1``, ``2``, ``4``, ``8``. Defaults to ``1``. -- **glyphs** (*Optional*, list): A list of characters you plan to use. Only the characters you specify - here will be compiled into the binary. Adjust this if you need some special characters or want to - reduce the size of the binary if you don't plan to use some glyphs. You can also specify glyphs by their codepoint (see below). Defaults to ``!"%()+=,-_.:°/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz``. +- **glyphsets** (*Optional*, list): A list of glyphsets you plan to use. Defaults to + ``GF_Latin_Kernel``, which contains the basic characters and necessary punctuation and symbols for + the English language. ``GF_Latin_Core`` is a more extended set that includes glyphs for the + languages of Europe and the Americas with over 5 million speakers. Other options include + ``GF_Arabic_Core``, ``GF_Cyrillic_Core``, ``GF_Greek_Core``, their ``Plus`` variants, as well as + ``GF_Latin_African``, ``GF_Latin_PriAfrican`` and ``GF_Latin_Vietnamese``. + See the `Google Fonts Glyphset documentation `_ + for an extensive list of all possible sets, along with their names and the languages supported by + each of those sets. Note that ``GF_Latin_Kernel`` may need to be included for glyphs for basic + characters such as numbers (0-9) and whitespace to be present. +- **glyphs** (*Optional*, list): A list of characters you plan to use, in addition to the characters + defined by the **glyphsets** option above. Adjust this list if you need some special characters or + want to reduce the size of the binary if you don't plan to use certain glyphs. Both single + characters (``a, b, c``) or strings of characters (``abc, def``) are acceptable options. You can + also specify glyphs by their codepoint (see below). +- **ignore_missing_glyphs** (*Optional*, boolean): By default, warnings are generated for any glyph + that is included in the defined **glyphsets** but not present in the configured font. Use this + setting to suppress those warnings. Please note that the absence of any manually defined glyphs + (specified via the **glyphs** option) will always be treated as an error and will not be influenced + by this setting. - **extras** (*Optional*, enum): A list of font glyph configurations you'd like to include within this font, from other OpenType/TrueType files (eg. icons from other font, but at the same size as the main font): - **file** (**Required**, string): The path of the font file with the extra glyphs. @@ -159,4 +186,5 @@ See Also - :doc:`/components/lvgl/index` - `MDI cheatsheet `_ - `MDI font repository `_ +- `Google Fonts Glyphsets `_ - :ghedit:`Edit` From 0194102de1df6fa946aba9d22f1fcec361b8915c Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:55:11 +1100 Subject: [PATCH 10/11] [spi_device] Rename mode to spi_mode (#4414) --- components/spi.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/spi.rst b/components/spi.rst index bf2f2543c8..f3cd46bd3a 100644 --- a/components/spi.rst +++ b/components/spi.rst @@ -126,7 +126,7 @@ Reads and writes on the device can be performed with lambdas. For example: id: spidev cs_pin: GPIOXX data_rate: 2MHz - mode: 3 + spi_mode: 3 bit_order: lsb_first on...: @@ -143,7 +143,7 @@ Configuration variables: - **data_rate** (*Optional*): Set the data rate of the controller. One of ``80MHz``, ``40MHz``, ``20MHz``, ``10MHz``, ``5MHz``, ``4MHz``, ``2MHz``, ``1MHz`` (default), ``200kHz``, ``75kHz`` or ``1kHz``. A numeric value in Hz can alternatively be specified. -- **mode** (*Optional*): Set the controller mode - one of ``mode0``, ``mode1``, ``mode2``, ``mode3``. The default is ``mode3``. +- **spi_mode** (*Optional*): Set the controller mode - one of ``mode0``, ``mode1``, ``mode2``, ``mode3``. The default is ``mode3``. See table below for more information - **bit_order** (*Optional*): Set the bit order - choose one of ``msb_first`` (default) or ``lsb_first``. - **cs_pin** (*Optional*, :ref:`Pin Schema `): The CS pin. From b2cad90fee1e622aec01b1da7ad96911b8c68f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Mart=C3=ADn?= Date: Wed, 6 Nov 2024 01:56:51 +0100 Subject: [PATCH 11/11] feat(MQTT): Add `enable`, `disable` and `enable_on_boot` (#4408) --- components/mqtt.rst | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/components/mqtt.rst b/components/mqtt.rst index 6930262256..9656d41a90 100644 --- a/components/mqtt.rst +++ b/components/mqtt.rst @@ -34,6 +34,7 @@ Configuration variables: ------------------------ - **broker** (**Required**, string): The host of your MQTT broker. +- **enable_on_boot** (*Optional*, boolean): If enabled, MQTT will be enabled on boot. Defaults to ``true``. - **port** (*Optional*, int): The port to connect to. Defaults to 1883. - **username** (*Optional*, string): The username to use for authentication. Empty (the default) means no authentication. @@ -733,6 +734,57 @@ Configuration options: root["something"] = id(my_sensor).state; }); +``mqtt.disable`` Action +----------------------- + +This action turns off the MQTT component on demand. + +.. code-block:: yaml + + on_...: + then: + - mqtt.disable: + +.. note:: + + The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want MQTT to be enabled on boot. + + +``mqtt.enable`` Action +---------------------- + +This action turns on the MQTT component on demand. + +.. code-block:: yaml + + on_...: + then: + - mqtt.enable: + +.. note:: + + The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want MQTT to be enabled on boot. + ``mqtt.enable`` can be useful for custom setups. For example, if the broker name is negotiated dynamically and saved in a global variable. + +.. code-block:: yaml + + mqtt: + id: mqtt_id + broker: "" + enable_on_boot: False + + globals: + - id: broker_address + type: std::string + restore_value: yes + max_restore_data_length: 24 + initial_value: '"192.168.1.2"' + + on_...: + then: + - lambda: !lambda id(mqtt_id).set_broker_address(id(broker_address)); + - mqtt.enable: + .. _mqtt-connected_condition: ``mqtt.connected`` Condition