> {% macro getIntro() %} {% if is_state("sensor.jeff_location", "home") %} {{ [ "I am not sure why you are asking me,", "You must be having vision problems.", "I don't want to alarm you, but" ] | random }} Jeff is already home! {% else %} {% if is_state("sensor.jeff_destination", "na") %} {%- if states.device_tracker.life360_jeffrey_stone.attributes.moving == True %} Jeff is currenly moving, but {{ [ "I am unable to determine his destination.", "I am having trouble tracking him.", "His destination is currently unknown." ] | random }} At last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. {%- elif states.device_tracker.life360_jeffrey_stone.attributes.driving == True %} Jeff is currenly moving, but {{ [ "I am unable to determine his destination.", "I am having trouble tracking him.", "His destination is currently unknown." ] | random }} At last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. {% else %} {% if is_state("sensor.jeff_location", "Lost") %} Jeff is lost, but at last check was {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes from home. {% else %} Jeff is currently at {{ states.sensor.jeff_location.state }}. {% endif %} {% endif %} {% elif is_state("sensor.jeff_destination", "home") %} Jeff is currenly heading home and will be here in {{states.sensor.jeff_ett_home.attributes.duration | round}} minutes. {% else %} Jeff is heading to {{ states.sensor.jeff_destination.state }}. {% endif %} {% endif %} {% endmacro %} {# a macro that removes all newline characters, empty spaces, and returns formatted text #} {%- macro cleanup(data) -%} {%- for item in data.split("\n") if item | trim != "" -%} {{ item | trim }} {% endfor -%} {%- endmacro -%} {# a macro to call all macros :) #} {%- macro mother_of_all_macros() -%} {{ getIntro() }} {%- endmacro -%} {# Call the macro #} {{- cleanup(mother_of_all_macros()) -}}