I would like to make an input boolean that is based on a sensor attribute. The sensor is sensor.pixel_5_bluetooth_connection and its attribute is connected_paired_devices which lists the MAC addresses of paired devices. I want the input boolean to be on if a particular MAC address is connected, and off otherwise.
The application for this is so that I can know if I’m driving around in a particular car so that I can open the correct garage door when I get home.
Thanks! After a bunch of tinkering, I ended up with this. In case it helps anyone.
template:
- binary_sensor:
- name: "Guy is in Mazda"
state: >
{% if '00:4E:00:4E:AC:EA' in state_attr('sensor.pixel_5_bluetooth_connection', 'connected_paired_devices') %}
on
{% else %}
off
{% endif %}
I used the if/else statement in the event that the phone happens to also be connected to other devices. This block of code searches for a particular MAC address in the string.