Getting value from entity state

Hello, my first post here. I have problems with getting some information from sensor state. I just want get information that I’m in a car. Simplest way that I found is - if I’m connected with phone to my car via BT = I’m in car

so I fave something like this:

- platform: template
    sensors:
      bt_device:
        friendly_name: "BT"
        value_template: "{{ state_attr('sensor.my_phone_connection', 'connected_paired_devices') }}"

but it returns all connected MAC Adr BT devices. So I added

     bt_device_splited:
        friendly_name: "BT splited"
        value_template: "{{ states.sensor.bt_device.split(',')[0] }}"

Now it returns first listed BT device. If I have luck it can be my car, but…

So I need something, that checks/search state values from bt_device, and if it find specified string (this case MAC Adr) returns - “I’m in Car”

I recently set up something like this. Here’s the value template I used:

{% if not is_state('sensor.scott_s_phone_bluetooth_connection','0') and not state_attr('sensor.scott_s_phone_bluetooth_connection','connected_paired_devices') == none -%}
  {% set connected_paired = state_attr('sensor.scott_s_phone_bluetooth_connection','connected_paired_devices') %}
  {% set mac_scott_car = 'XX:YY:ZZ:AA:BB:CC' %}
  {%- if mac_scott_car in connected_paired %}true{% else %}false{% endif %}
{% else %}false
{% endif %}

I’ve been using it successfully for a couple weeks.

this is all I use and it works fine:

"{{ '84:DD:20:62:FA:FE' in state_attr('sensor.my_mobile_app_bluetooth_connection', 'connected_paired_devices') }}"