> {# Nightky Report #} {%- macro getReport() -%}
{% 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 %}
{% 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 %}
{{ [ 'The sun is officially down. Exterior Cameras are now motion activated.', 'The sun has been ushered off the stage. I have armed the perimiter cameras.', 'You are running out of daylight. Time to wrap up any outside chores.', 'Switching Anchorage House to night mode! ', 'The outside world has switched to dark mode.', 'It is a little past Sunset. Time to turn on the outside lights. I am on it.', 'I will switch on the outside lights. It is getting dark outside.', 'Time to turn on the front lights. I will take care of it.', 'If you have not looked outside lately, the light of the day is almost gone.' ]|random }}
{% if is_state('binary_sensor.garage_door', 'on') %}{{ [ 'The garage door is open. ', 'The pod bay doors are open. ', 'Someone forgot to close the garage.' ] | random }}
{% elif is_state('binary_sensor.side_door', 'on') %}{{ [ 'The side door is ajar. ', 'The side door is open. ', 'Someone forgot to close the side door.' ] | random }}
{% else %} {% endif %}{% 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 %}
{{ [ 'Tonight we can expect,', 'Expect weather tonight to be,' ]|random }} {{ states.sensor.nws_overnight_forecast.state }}
{% if is_state('input_boolean.freeze_warning','on') %}
{{ [ 'The temperature is expected to be near or below freezing.
{{ [ 'Do not forget to bring in the trash cans. ',
'The trash cans will feel lonely if you leave them out all night. ',
'The
{% if states.sensor.halloween_countdown.state | int == 1 %}
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I
{% if states.sensor.trip_disney.state | int == 120 %} There are only one hundred and twenty days until the next Disney Trip. {% endif %} {% if states.sensor.trip_disney.state | int == 60 %} There are only on sixty days until the next Disney Trip. {% endif %} {% if states.sensor.trip_disney.state | int < 32 %} {% if states.sensor.trip_disney.state | int > 1 %} There are {{ states.sensor.trip_disney.state }} days until the next Disney Trip! {% else %} There is {{ states.sensor.trip_disney.state }} day until the next Disney Trip! {% endif %} {% endif %} {% if states.sensor.anniversary_our_wedding.state | int == 1 %} Tomorrow is Jeff and Katherine's Wedding Anniversary. {% endif %}
{% if states.sensor.trip_disney.state | int == 1 %} Oh, and there is just one more sleep until the next Disney Trip! {% 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() -%} {{ getReport() }} {%- endmacro -%} {# Call the macro #} {{- cleanup(mother_of_all_macros()) -}}