Trigger by specific Bluetooth device connection

Have a trigger state node that looks like this:

I want it to trigger when I return home after a run and my running watch’s Bluetooth connects to mobile phone and the Companion App bluetooh sensor changes state.
I can see that connection of the watch is registered (MAC [10:4E:89:D9:43:C8] ) but I need help how to get Success in finding that new connection.
I get this output:
trigger state node 2
I guess the issue is how I compare the property of “connected paired devices” to my device MAC, if there was only my watch connected I could use “is” instead of “in”.
Can someone please help me sort this out?

Try changing exact to substring and maybe remove the brackets from the mac.

Thanks, but no, didn’t work.

I guess you tried no brackets and exact? I’m not sure what it needs to be but you could also use an event state and switch.


Hello! Were you able to sort this out?

I’m trying almost the same, just checking if phone is connected to car Bluetooth.

Yes, got it to work, ended up using a regular expression as below.
Have no experience with regular expressions but found enough info to get it working.
I just searched for the last three hex digits (D9 43 C8) in my Garmin MAC address and then got a “success”. Note the backslashes.
Good luck!

1 Like

Although highly unlikely, your regex will match if the first three hex digits match too, or the three in the middle.
If you add a $ after C8 then it will only match the last three.

As you said, probability like 1 in a billion but good to know for future reference.
You seem skilled, perhaps you understand why my original attempt didn’t work?
(using the complete string)

I think the issue is that the paired devices is an array


Not sure if you can compare with that since it could be array item 2 that this paired device is.
I use an function node to do my comparison.
How to use bluetooth connection sensor? - Mobile Apps / Home Assistant Companion for Android - Home Assistant Community (

Looking at the original, I believe the brackets [] is causing it not to match. Use just the mac.

It’s working great!!! :slight_smile:
Also I can give an exact Bluetooth address to it not just the first 3 part :slight_smile: So yeah, it’s works like a charm!
Thank you very much!!!
Best: Peter

Maybe worth a mention that Output on connect needs to be true, or the trigger always giving me true.

Best: Peter

Glad I could help!
Don’t think you need the “Output on connect” (I don’t have it), I think that tells Node Red to update/create output when it starts the flow after editing.
The issue you had with getting True all the time was probably that bluetooth connection hadn’t timed out yet so setting that option forced an update that would have happened a bit later anyway.
@Mikefila, tried without brackets earlier, does not work (as I wrote earlier in the thread)

Disregard it always comes back true not sure why

Ok instead try is jsonata with


The problem (in my case) is the string “complete” isn’t the MAC only perhaps the BT device name. Ex:

E0-E0-E9-A5-9A-1C (BT_PEUGEOT)

Sorry for the noob question, but I don’t recognise the UI in the OPs and @nikler’s post. Could someone direct me, please?

Also, is it possible to “detect” when a BT device connects and disconnects?

Thank you…

Every day’s a school day. For others on the HA learning path:

To answer my own question, the above screenshots are from an add-on called Node-RED

Although the add-on says there’s nothing to do other than install and set a password, when attempting to use it, you’ll get a warning that the Node-RED companion is required. The install instructions are here. I couldn’t use HACS method of installing as it wouldn’t recognise the developer’s repository, so I followed the manual method.

The state node (as per OPs screenshot) is a trigger: state node.


I’m pretty sure that’s not correct, you’ve probably installed something else that requires that.
If I remember correctly the Node red companion is for creating entities in Node red that are exposed to HA.

Hi @nikler,

You may be right. I added a node. I forget which one. Something like current_state or get entities. When double-clicking the node, there was a warning about alpha and requiring the companion.


Did you get this sorted out?
Use reg. expression to solve it.
I don’t know how exactly but you can test your way forward, there are online sites where you can test different expressions and see the results right away (that’s how I did it)