>
  {# Morning Report #}
  {%- macro getReport() -%}
    <p>
      {% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
        Good morning.
      {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
        Good afternoon.
      {% else %}
        Good evening.
      {% endif %}
      </p>
      <p>
      {% if now().strftime('%H')|int < 12 %}
        {% if now().strftime('%M')|int == 0 %}
          It is {{ now().strftime('%H')|int }} AM.
        {% else %}
          It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} AM.
        {% endif %}

      {% elif now().strftime('%H')|int > 12 %}
        {% if now().strftime('%M')|int == 0 %}
          It is {{ now().strftime('%H')|int }} PM.
        {% else %}
          It is {{ now().strftime('%H')|int }} {{ now().strftime('%M')|int }} PM.
        {% endif %}
      
      {% else %}

      {% endif %}
      </p>
      <p>
      {{ [
          'Today is ',
          'If you have not been keeping track today is ',
          'Do you know what day of the week it is? Today is',
          'I hate to be the bearer of bad news, but today is '
      ]|random }}
      {{states.sensor.today_is.state }}.
      </p>
      <p>
        It is currently {{states.weather.home_2.state}} and {{states.sensor.acurite_6045m_3078_t.state|round}} degrees in Grayson. 
      </p>
      <p>
        {% if states.sensor.nws_alerts.state | int > 0 %}
          There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
          The National Weather Service Has issued,
          {% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
            a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}.
          {% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
          a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] }}.
          {% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] is defined %}
            a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[3] }}.
          {% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] is defined %}
            a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[2] }}.
          {% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] is defined %}
            a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[1] }}.
          {% else %}
            a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[0] }}.
          {% endif %}
        {% endif %}
      </p>
      <p>
        {{ [
            'The rest of the day should be,',
            'Todays forecast should be ,'
        ]|random }}
          {{ states.sensor.nws_current_forecast.state }} 
        </p>
        <p>
          {% if is_state('input_boolean.heartworm', 'on') %}
            Today is the day Winston gets his heartworm medicine. 
          {% endif %}
        </p>
        <p>
          {% if is_state('sensor.today_is', 'Monday') %}
            {% if now().strftime('%H')|int > 17 %}
            {{ [ 'Do not forget tomorrow is Trash Day. ',
              'I advise you move the trash cans to the curb for the weekly pickup. ',
              ' The trash and recycle should go out.'
            ] | random }}
            {% endif %}
          {% endif %}
        </p>
        <p>
        {% if is_state('sensor.halloween_countdown','0') %}
          Happy Halloween!
        {% endif %}
        {% if is_state('sensor.christmas_countdown','0') %}
          Merry Christmas Everyone!
        {% endif %}
        {% if is_state('sensor.anniversary_our_wedding','0') %}
          Happy Anniversary! It been an amazing {{ states.sensor.anniversary_our_wedding.attributes.years }} years!
        {% endif %}
        {% if is_state('calendar.holidays_in_united_states', 'on') %}
          Today is {{states.calendar.holidays_in_united_states.attributes.message}}. 
        {% endif %}
        {% if is_state('calendar.anchorage_holidays', 'on') %}
          And do not forget. Today is also {{states.calendar.anchorage_holidays.attributes.message}}. 
        {% endif %}
        {% if states.calendar.birthdays.state == 'on' %}
          Today is {{ states.calendar.birthdays.attributes.message }}! So Happy Birthday! The confetti cannon is not working otherwise I would shower you in paper garbage that someone else would have to pick up.
        {% endif %}
        {%- set event=states.calendar.national_holidays.attributes.message %}
        {% if 'Day' in event and 'National' in event%}
          {{ [
            'And a very special Happy ',
            'It is also ',
            'Today is also known as ',
            'Oh <emphasis>Look</emphasis>. Today is ',
            'Want to know a fact? Today is ',
            'Everyday can be a holiday. So today is '
        ]|random }}
        {{states.calendar.national_holidays.attributes.message | replace("&"," and ") }}.
        {%- endif -%}
        </p>
        <p>

          {%- if states.sensor.home_to_zoo.state|round > 50 %}
            Traffic to the Zoo appears heavy than normnal.
          {% else %}
            Traffic to the Zoo is normal.
          {% endif %}
          Currently it will take {{states.sensor.home_to_zoo.state|round}} minutes to get to the Zoo.

          {%- if states.sensor.home_to_summit.state|round > 50 %}
            Traffic to Summit appears heavy than normnal.
          {% else %}
            Traffic to Summit is normal.
          {% endif %}
          Currently it will take {{states.sensor.home_to_summit.state|round}} minutes to get to Summit taking {{ states.sensor.home_to_summit.attributes.route }}.
      </p>
  {%- 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() -%}
      {{ getReport() }}
    {%- endmacro -%}
    
    {# Call the macro  #}
    {{- cleanup(mother_of_all_macros()) -}}