I copied a template sensor from a blog that shows my current room when i the house and home or away when I’m not. Now i want to change the template sensor to “driving” if i’m connected to my car. MAC addess contains the C2:D2 below. I think I have something wrong in my if elif else statements. could someone help me out please? thanks.
template:
- sensor:
- unique_id: "maciek_location"
attributes:
friendly_name: "maciek's Location"
entity_picture: "/local/image/maciek.jpg"
state: >-
{% if states('sensor.maciek_current_room') != 'unknown' and states('sensor.maciek_current_room') != 'unavailable'%}
{{ states('sensor.maciek_current_room') }}
{% elif '2C:2D' in state_attr('sensor.rmx2170_bluetooth_connection', 'connected_paired_devices') %}
{{ states('person.maciek').replace('not_home', 'Driving').title() }}
{% else %}
{{ states('person.maciek').replace('not_home', 'Away').title() }}
{% endif %}