I am not sure what I am doing wrong here:

My device tracker attributes look like this:



I configured the sensors as follows:

########################################### # Location Sensor ########################################### - platform: template sensors: audi_status: value_template: "{{ 'Home' if is_state('device_tracker.2015_audi_rs_5', 'home') else 'Driving' }}" ########################################### # Fuel Level ########################################### - platform: template sensors: audi_gas: friendly_name: "Fuel Level" unit_of_measurement: "%" value_template: >- {%- if 'states.device_tracker.2015_audi_rs_5' %} {{ 'states.device_tracker.2015_audi_rs_5.attributes.fuel_level' | round }} {% else %} {{ 'states.device_tracker.2015_audi_rs_5.attributes.fuel_level' | round }} {%- endif %} icon_template: mdi:gas-station

I don’t understand what I am doing wrong. Anyone see it?