170 lines
7.8 KiB
YAML
Executable File
170 lines
7.8 KiB
YAML
Executable File
>
|
|
{# Nightky 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>
|
|
{{ [
|
|
'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 }}
|
|
</p>
|
|
<p>
|
|
{% 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 %}
|
|
</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>
|
|
{{ [
|
|
'Tonight we can expect,',
|
|
'Expect weather tonight to be,'
|
|
]|random }}
|
|
{{ states.sensor.nws_overnight_forecast.state }}
|
|
</p>
|
|
<p>
|
|
{% if is_state('input_boolean.freeze_warning','on') %}
|
|
{{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ',
|
|
'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.',
|
|
'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.',
|
|
'I would say winter is coming. But, based on the weather forecast <emphasis>it</emphasis> appears to be here.',
|
|
'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.'
|
|
] | random }}
|
|
{% endif %}
|
|
</p>
|
|
|
|
{% if is_state('sensor.today_is', 'Tuesday') %}
|
|
{% if now().strftime('%H')|int > 17 %}
|
|
{{ [ 'Do not forget to bring in the trash cans. ',
|
|
'The trash cans will feel lonely if you leave them out all night. ',
|
|
'The <say-as interpret-as="characters">HOA</say-as> will get mad if you leave those trash cans out on the street.'
|
|
] | random }}
|
|
{% endif %}
|
|
{% endif %}
|
|
</p>
|
|
<p>
|
|
{% 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 <emphasis>dare</emphasis> you to ask me to open them. '
|
|
] | random }}
|
|
{% elif states.sensor.halloween_countdown.state | int < 30 %}
|
|
There are only {{states.sensor.halloween_countdown.state}} days
|
|
{{ [ 'until Halloween.',
|
|
'until Halloween. It might not be enough time. ',
|
|
'and counting until the best holiday ever.',
|
|
'until you need a costume.'
|
|
] | random }}
|
|
|
|
{% else %}
|
|
{% endif %}
|
|
|
|
{% if states.sensor.christmas_countdown.state | int == 1 %}
|
|
Tomorrow is Christmas. <break time="1s"/> It is practically here! <break time="1s"/> Santa is coming tonight! Do not forget the cookies!
|
|
{% elif states.sensor.christmas_countdown.state | int < 31 %}
|
|
There are only {{states.sensor.christmas_countdown.state}} days until christmas.
|
|
{{ [ 'All I want for Christmas, is a hippopotamus.',
|
|
'Hey Skylar, I know what you are getting for Christmas. But <emphasis>I am</emphasis> not telling.',
|
|
'Do not forget to put something under the tree for <emphasis>your</emphasis> favorite smarthome.',
|
|
'It is starting to smell a lot like Christmas. Or it could be the christmas tree is on fire.',
|
|
'I do not want to be a smarthome. I want to be a dentist.',
|
|
'Do not eat all the cookies. '
|
|
] | random }}
|
|
{% else %}
|
|
{% endif %}
|
|
</p>
|
|
<p>
|
|
{% 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 %}
|
|
</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()) -}} |