How to use mobile app bluetooth connection in automation (gui)

I’m trying to create a GUI automation that, after triggered, will only run if the mobile app (Android) is connected to a specific paired device.
In the app, I can see what it is connected to.

In the automation “And if” section, I have:
Entity: phone Bluetooth connection
Attribute: connected paired devices
State: I’ve tried everything I can think of, and nothing works.

I assume it should be the MAC address of the connected paired device.
How should the MAC be expressed?

Thanks!

Looks like the attribute is set to the MAC and device name like this.

14:13:0B:14:BF:69 (Venu 2 Plus)

If you go to Developer Tools, and check the state for the entity, it’ll give you the exact string you’re looking for.

I was pretty sure I had tried that. I tried again and it didn’t work. Looking at the trace, I’m not sure what caused the test to produce a “false”.

If you look at the trace (above), and the “connected paired” list within the app, the state shown in they show a "- " before the MAC address.
I also tried adding the "- ".
(yaml list?)
When you do that, the “wanted_state” in the trace shows in single quotes

In the the “paired” list within the app, the MAC addresses are listed in [square brackets]. I tried that too.

For experimentation sake, I tried to find a way to look for an empty list of “connected paired” devices and couldn’t find a way that worked.

I’ve been using the “built in” automation engine for presence detection because it was easier and I didn’t want a node-red flow that polls. But I may just have to have the script send a message to node-red and let it do the work. I just tested that. It’s simple for node-red to check the “connected paired” list.

This is reminding me of an ancient “Ohio Scientific” computer I had. The owners manual wasn’t very specific about the command syntax, so you just had to try things until you found the correct syntax.

Thanks,

{{‘77:77:AA:77:7A:77 (My Car)’ in state_attr(‘sensor.phone_bluetooth_connection’, ‘connected_paired_devices’)}}

This is what I have for a bluetooth connection template sensor