Changes

no edit summary
Line 1: Line 1: −
<pre class="header-style">
+
<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. The following options are available:
     −
* Bluetooth Enabled
+
''' Options '''
* Bluetooth Disabled
  −
* Bluetooth Connected
  −
* Bluetooth Disconnected
  −
</pre>
     −
'''Magic Text'''<br/>
+
* '''Bluetooth Enabled''' - Trigger fires when Bluetooth is turned on
When this trigger is used, you can access magic text via the [...] button where available.<br/>[https://macrodroidforum.com/wiki/index.php/Magic_text#Bluethooth_.28Device_connected_or_device_disconnected.29 Magic text]
+
* '''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
   −
'''Example Usage:'''<br/>
+
''' Device Selection '''
When connected to a specific Bluetooth Speaker automatically set the volume to 50%.
     −
<pre class="trigger-style">
+
When selecting "Device Connected" or "Device Disconnected", you can specify which device to monitor:
Triggers
     −
Bluetooth Device Connected (Anker Speaker)
+
* '''Any Device''' - Trigger fires for any Bluetooth device connection/disconnection
</pre>
+
* '''Specific Device''' - Choose from a list of paired devices. The list shows the device alias/name and MAC address.
<pre class="action-style">
  −
Actions
     −
Media volume = 50%
+
If Bluetooth is currently disabled when configuring the trigger, you will be prompted to enable it so that paired devices can be listed.
</pre>
+
 
 +
''' 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_On_Off|Bluetooth On/Off Action]]
 +
* [[Constraint:_Bluetooth|Bluetooth Constraint]]
 +
* [[Trigger:_Bluetooth_Beacon|Bluetooth Beacon Trigger]]