This is a Tasker plugin
BlueTask allows audio routing using BT headset. In addition it can intercept the pressure of headset buttons, about the setup: after the button has been pressed with the screen on of your smartphone, select "BlueTask" when the system shows the popup "Complete action with" and select "Always".
It allows to force connection or disconnection to a BT device.
It allows to perform BT scan to get list of near devices with RSSI value (in order to get a device, the device must be in discoverable state).
It allows to get battery level information (Android 8.1+)
Requires Tasker 4.4+