Difference between revisions of "Trigger: Bluetooth Event"

m
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">The Bluetooth Event trigger fires when the Bluetooth state changes on the device. It can be configured to fire when Bluetooth is enabled or disabled, or when connected to or disconnected from a specific Bluetooth device.</pre>
This trigger will fire when the Bluetooth state changes.
 
  
You can configure it to fire when Bluetooth is enabled or disabled, or when connected to/disconnected from a specific device.
+
''' Options '''
This trigger can be configured to fire when you come in range of, or go out of range of a Bluetooth beacon.
 
</pre><br>
 
'''Example Usage'''<br/>
 
When Bluetooth is enabled connect to a Bluetooth device (e.g. Headphones).
 
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
 
Triggers
 
  
Bluetooth is enabled
+
* '''Bluetooth Enabled''' - Trigger fires when Bluetooth is turned on
</pre><br>
+
* '''Bluetooth Disabled''' - Trigger fires when Bluetooth is turned off
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
+
* '''Device Connected''' - Trigger fires when a Bluetooth device connects
Actions
+
* '''Device Disconnected''' - Trigger fires when a Bluetooth device disconnects
  
Connect to a Bluetooth device (Headphones).
+
''' Device Selection '''
</pre><br>
 
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
 
Constraints
 
  
 +
When selecting "Device Connected" or "Device Disconnected", you can specify which device to monitor:
  
</pre><br>
+
* '''Any Device''' - Trigger fires for any Bluetooth device connection/disconnection
 +
* '''Specific Device''' - Choose from a list of paired devices. The list shows the device alias/name and MAC address.
 +
 
 +
If Bluetooth is currently disabled when configuring the trigger, you will be prompted to enable it so that paired devices can be listed.
 +
 
 +
''' Magic Text '''
 +
 
 +
When this trigger fires for device connection/disconnection events, the following information is available via magic text:
 +
* The name of the connected/disconnected Bluetooth device {bluetooth_device_name}
 +
 
 +
''' Examples '''
 +
 
 +
''Example 1: Set Media Volume for Speaker''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Device Connected (Anker Speaker)</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Volume Change: Media Volume to 50%</pre>
 +
 
 +
''Example 2: Disable Bluetooth at Night''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Bluetooth Enabled</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Disable Bluetooth</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Time of Day: 11:00 PM - 6:00 AM</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* The trigger listens for system broadcasts: ACTION_STATE_CHANGED for Bluetooth on/off, and ACTION_ACL_CONNECTED/ACTION_ACL_DISCONNECTED for device connections
 +
* Device selection shows both the device alias (user-defined name) and the device's MAC address for identification
 +
* Only paired devices are shown in the selection list
 +
* The trigger uses a shared receiver for efficiency when multiple macros use Bluetooth triggers
 +
 
 +
''' Permissions Required '''
 +
 
 +
* '''Bluetooth Connect''' - Required on Android 12+ (BLUETOOTH_CONNECT permission)
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action:_Bluetooth_Configure|Bluetooth On/Off Action]]
 +
* [[Constraint:_Bluetooth_State|Bluetooth Constraint]]
 +
* [[Trigger:_Bluetooth_Beacon_(experimental)|Bluetooth Beacon Trigger]]

Latest revision as of 21:51, 5 January 2026

The Bluetooth Event trigger fires when the Bluetooth state changes on the device. It can be configured to fire when Bluetooth is enabled or disabled, or when connected to or disconnected from a specific Bluetooth device.

Options

  • Bluetooth Enabled - Trigger fires when Bluetooth is turned on
  • Bluetooth Disabled - Trigger fires when Bluetooth is turned off
  • Device Connected - Trigger fires when a Bluetooth device connects
  • Device Disconnected - Trigger fires when a Bluetooth device disconnects

Device Selection

When selecting "Device Connected" or "Device Disconnected", you can specify which device to monitor:

  • Any Device - Trigger fires for any Bluetooth device connection/disconnection
  • Specific Device - Choose from a list of paired devices. The list shows the device alias/name and MAC address.

If Bluetooth is currently disabled when configuring the trigger, you will be prompted to enable it so that paired devices can be listed.

Magic Text

When this trigger fires for device connection/disconnection events, the following information is available via magic text:

  • The name of the connected/disconnected Bluetooth device {bluetooth_device_name}

Examples

Example 1: Set Media Volume for Speaker

Triggers

Device Connected (Anker Speaker)
Actions

Volume Change: Media Volume to 50%

Example 2: Disable Bluetooth at Night

Triggers

Bluetooth Enabled
Actions

Disable Bluetooth
Constraints

Time of Day: 11:00 PM - 6:00 AM

Notes

  • The trigger listens for system broadcasts: ACTION_STATE_CHANGED for Bluetooth on/off, and ACTION_ACL_CONNECTED/ACTION_ACL_DISCONNECTED for device connections
  • Device selection shows both the device alias (user-defined name) and the device's MAC address for identification
  • Only paired devices are shown in the selection list
  • The trigger uses a shared receiver for efficiency when multiple macros use Bluetooth triggers

Permissions Required

  • Bluetooth Connect - Required on Android 12+ (BLUETOOTH_CONNECT permission)

See Also