home-assistant-configuration/templates/morning_report.yaml

94 lines
4.2 KiB
YAML
Raw Normal View History

2019-02-21 17:49:55 +00:00
>
{% macro getGreeting() %}
{{ [ "Good morning Anchorage House. Rise and Shine. ",
"Good morning everyone. ",
"Good morning. The early bird gets the worm. And look over there. A worm. Wait, is that a snake. umm, someone might want to take care, ok, moving on.",
"Good morning. The early bird gets the worm.",
"Good morning from the bridge.",
"I hope I am not waking you, but I think this would be a good time for the morning report."
] | random }}
{% if is_state("input_boolean.guest_mode", "on") %}
{{ [ "And a special welcome to our guests. ",
"And good morning to our guests as well. ",
"Hey look at that, someone came to visit Anchorage House. Hope you slept well."
] | random }}
{% endif %}
{% endmacro %}
2019-02-21 17:49:55 +00:00
{% macro getTodaysEvent() %}
{% if is_state("sensor.holiday_halloween","0") %}
This is Halloween, this is halloween. Happy Halloween!
2019-02-21 17:49:55 +00:00
{% endif %}
{% if is_state("sensor.holiday_christmas","0") %}
Merry Christmas Everyone!
{% endif %}
{% if is_state("sensor.anniversary_our_wedding","0") %}
Happy Anniversary! It has 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}}.
2019-02-21 17:49:55 +00:00
{% endif %}
{% endmacro %}
{% macro getCurrentConditions() %}
It's currently {{states.sensor.dark_sky_summary.state}} and {{states.sensor.dark_sky_temperature.state|round}} degrees according to Dark Sky.
The back porch is {{states.sensor.accurite_back_porch_temperature.state|round}} degrees and
The inside temperature is {{states.climate.home.attributes.current_temperature|round}} degrees. The Climate is set to {{states.climate.home.state}}.
2019-02-21 17:49:55 +00:00
{% endmacro %}
{% macro getForecast() %}
The rest of the day should be {{states.sensor.dark_sky_summary_0d.state}} with a high of {{states.sensor.dark_sky_daytime_high_temperature_0d.state|round}} degrees. There is a {{states.sensor.dark_sky_precip_probability_0d.state|round}} percent chance of rain.
2019-02-21 17:49:55 +00:00
{% endmacro %}
2019-02-21 17:49:55 +00:00
{% macro getBirthdays() %}
{% if states.calendar.birthdays.state == "on" %}
Today is {{ states.calendar.birthdays.attributes.message }} birthday!
{% else %}
{% if states.sensor.birthday_skylar.state | int == 1 %}
Tomorrow is Skylar's Birthday.
{% endif %}
{% if states.sensor.birthday_jeff.state | int == 1 %}
Tomorrow is Jeff's Birthday.
{% endif %}
{% if states.sensor.birthday_kat.state | int == 1 %}
Tomorrow is Katherine's Birthday.
{% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
{% endif %}
{% endmacro %}
{% macro getAnniversary() %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
{% endmacro %}
{% macro getHolidays() %}
{% if states.sensor.holiday_halloween.state | int == 1 %}
Tomorrow is Halloween. Hope you have picked out a costume.
{% endif %}
{% if states.sensor.holiday_christmas.state | int == 1 %}
Tomorrow is Christmas. It's practically here! Santa is coming tonight! Don't forget the cookies!
{% elif states.sensor.holiday_christmas.state | int < 25 %}
There are only {{states.sensor.holiday_christmas.state}} days until christmas.
{% else %}
{% 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() -%}
{{ getGreeting() }}
2019-02-21 17:49:55 +00:00
{{ getTodaysEvent() }}
{{ getCurrentConditions() }}
2019-02-21 17:49:55 +00:00
{{ getForecast() }}
{{ getBirthdays() }}
{{ getAnniversary() }}
{{ getHolidays() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}