Bluetooth Switch
The ble switch platform provides switches that control Bluetooth. It currently requires the
ESP32 BLE component to be configured on the same device.
# Example configuration entryswitch: - platform: ble type: enabled name: "Bluetooth"Configuration Variables
Section titled “Configuration Variables”- type (Required, enum): The kind of Bluetooth switch. The only option is
enabled. - ble_id (Optional, ID): The ID of the ESP32 BLE component to control.
- restore_mode (Optional): Control how the switch attempts to restore state on bootup.
Defaults to
RESTORE_DEFAULT_ON. See Switch for the options. - All other options from Switch, except
inverted.
Only one switch of each type can be configured.
enabled Switch
Section titled “enabled Switch”The enabled switch turns Bluetooth on and off, the same as the
ble.enable and ble.disable
actions. The switch also follows those actions, so it always shows the Bluetooth state that was last requested, and
that state is the one saved for restore_mode.
When the switch is configured, its restore_mode decides whether Bluetooth is enabled when the device starts. With
the default RESTORE_DEFAULT_ON, Bluetooth that was turned off stays off after a restart. The
enable_on_boot option of the ESP32 BLE component is only used
when restore_mode is DISABLED.