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.
     −
* Bluetooth Enabled
+
''' Options '''
* Bluetooth Disabled
  −
* Bluetooth Connected
  −
* Bluetooth Disconnected
     −
When this trigger is present, you can use more [...]
+
* '''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
   −
</pre>
+
''' Device Selection '''
   −
'''Magic Text'''<br/>
+
When selecting "Device Connected" or "Device Disconnected", you can specify which device to monitor:
[https://macrodroidforum.com/wiki/index.php/Magic_text#Bluethooth_.28Device_connected_or_device_disconnected.29 Magic text]
     −
'''Example Usage:'''<br/>
+
* '''Any Device''' - Trigger fires for any Bluetooth device connection/disconnection
When you activate airplane mode between the hours of 10:00 p.m. and 7:00 a.m., mute the media volume.
+
* '''Specific Device''' - Choose from a list of paired devices. The list shows the device alias/name and MAC address.
   −
<pre class="trigger-style">
+
If Bluetooth is currently disabled when configuring the trigger, you will be prompted to enable it so that paired devices can be listed.
Triggers
     −
Airplane mode enabled
+
''' Magic Text '''
</pre>
  −
<pre class="action-style">
  −
Actions
     −
Media volume = 0
+
When this trigger fires for device connection/disconnection events, the following information is available via magic text:
</pre>
+
* The name of the connected/disconnected Bluetooth device {bluetooth_device_name}
<pre class="constraint-style">
  −
Constraints
     −
Time of day (10:00 p.m. - 7:00 a.m.)
+
''' Examples '''
</pre><br>
+
 
 +
''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]]