From ff51c1de12be62a433a0e085b467709d205c20dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Mart=C3=ADn?= Date: Mon, 6 Nov 2023 03:54:42 +0100 Subject: [PATCH] feat: Add ESP32 BLE enable/disable automations (#3303) --- components/esp32_ble.rst | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/components/esp32_ble.rst b/components/esp32_ble.rst index 146d7e868..a6dabd9dd 100644 --- a/components/esp32_ble.rst +++ b/components/esp32_ble.rst @@ -34,6 +34,61 @@ Configuration variables: - ``keyboard_display`` - A keyboard and a display - ``display_yes_no`` - A display to show PIN codes and buttons to confirm or deny the connection +- **enable_on_boot** (*Optional*, boolean): If enabled, the BLE interface will be enabled on boot. Defaults to ``true``. + +``ble.disable`` Action +----------------------- + +This action turns off the BLE interface on demand. + +.. code-block:: yaml + + on_...: + then: + - ble.disable: + +.. note:: + + The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want BLE to be enabled on boot. + + +``ble.enable`` Action +---------------------- + +This action turns on the BLE interface on demand. + +.. code-block:: yaml + + on_...: + then: + - ble.enable: + +.. note:: + + The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want BLE to be enabled on boot. + + +.. _ble-enabled_condition: + +``ble.enabled`` Condition +-------------------------- + +This :ref:`Condition ` checks if BLE is currently enabled or not. + +.. code-block:: yaml + + on_...: + - if: + condition: ble.enabled + then: + - ble.disable: + else: + - ble.enable: + + +The lambda equivalent for this is ``id(ble_id).is_active()``. + + See Also --------