Can't check BT connected devices anymorwe

Hi all.
It looks like that since I upgraded to 2022.6 I can’t detect connected devices anymore.
I was using this to open my gate automatically when my mobile gets connected to car in the morning, but it stopped working a couple of weeks ago.
I checked everything but I didn’t find a solution.
Here is an example using my miband, connected all the time but not paired:

This is the value_template:

value_template: “{{ is_state_attr(‘sensor.mi9t_pro_alex_bluetooth_connection’, ‘connected_not_paired_devices’, ‘[E6:9E:A6:7B:55:EC]’) }}”

1 Like

Could you paste in a picture of the sensor in state list in developer tools.
This will show us how the attribute data is formatted.

There was a breaking change to move from sending a strong to an actual list, you will need to update your automations. We also mentioned this breaking change in the change log prompt.

I think I missed that, I’ll check it now.
Thanks.

Is it this?
“Breaking change: Send sensor attributes as a list instead of string when possible”

Is there an example, maybe about another sensor, to have an idea of what kind of modification should be done? I think I undestood that in my code it’s used as a string, but I don’t know how to change it to a list.
Any example should be useful to help me to correct the code.
Thanks

1 Like

here is an example template I use to check if my phone is connected to my truck bluetooth:

"{{ 'AA:DD:BB:62:FA:FE' in state_attr('sensor.my_mobile_app_bluetooth_connection', 'connected_paired_devices') }}"
4 Likes

hi,
i post here because i have the same probleme and i can’t understand how to correct automation.

my orginal automation was

platform: state
entity_id:
  - sensor.mi10ha_bluetooth_connection
attribute: connected_paired_devices
to: '[80:19:34:78:98:AC]'

it does not work anymore
so i tryied to check in a condition and i can’t get it work
then i tryied the following but it does not work and my automation do not need this condition but a trigger

condition: template
value_template: >-
  "{{ '80:19:34:78:98:AC' in state_attr('sensor.mi10ha_bluetooth_connection', 'connected_paired_devices') }}"

i spent hours on this. the graphical editor lead you do it easily but it do not work anymore (to me.)
plz help

This worked!
Thank you very much!

1 Like

just create a template trigger using the same template:

trigger:
  - platform: template
    value_template: >
      {{ '80:19:34:78:98:AC' in state_attr('sensor.mi10ha_bluetooth_connection', 'connected_paired_devices') }}
1 Like

it’s all good thank you very much

1 Like

Just as an added tip to this solution. It would not work for me until I went into the developer tools and went to the STATES tab then looked up the sensor.myphone_bluetooth_connection and found the actual paired bluetooth device full name. On my phone it wasn’t just the MAC address in the format of ‘00:00:00:00:00:00’ but rather the MAC address followed by the name of the device enclosed in parentheses as in this format ‘00:00:00:00:00:00 (bluetooth device name)’. Hoping this can help someone like me who kept putting in just the MAC address and testing the condition which continually failed until I put in the full name just as it appears in the sensor.myphone_bluetooth_connection. If you go to the STATES tab in the Developer Tools and do a search on the page of bluetooth_connection it will take you right to that sensor where you will see all the MAC addresses and names associated with all the bluetooth devices you’ve connected to. No need to download a bluetooth device info app.