Added macros as detailed in #56

This commit is contained in:
CCOSTAN
2017-02-24 19:51:54 +00:00
parent bc3f6a334c
commit b1c5e82012
3 changed files with 19 additions and 5 deletions

View File

@@ -26,11 +26,10 @@
"Welcome home " ~ person, "Welcome home " ~ person,
"Guess who is home? " ~ person +" is!", "Guess who is home? " ~ person +" is!",
"Attention: " ~ person + " is now in the house.", "Attention: " ~ person + " is now in the house.",
person ~ " in da hiz Ouse!",
"Welcome Home " ~ person + ". We've missed you. or at least Molly did.", "Welcome Home " ~ person + ". We've missed you. or at least Molly did.",
"Our home is now complete, Rest your head and relax your feet! Welcome Back " ~ person, "Our home is now complete, Rest your head and relax your feet! Welcome Back " ~ person,
"Life is like a song, youre back where you belong. Welcome home " ~ person, "Life is like a song, youre back where you belong. Welcome home " ~ person,
"Hey there " ~ person, "Hey there " ~ person + " Welcome Home!",
person ~ "! You're home!" person ~ "! You're home!"
] | random }} ] | random }}
{%- endmacro -%} {%- endmacro -%}

View File

@@ -24,6 +24,7 @@
data_template: data_template:
value1: > value1: >
"Welcome Home. Here is what's going on around the house right now: "Welcome Home. Here is what's going on around the house right now:
{%- macro responsibilities() -%} {%- macro responsibilities() -%}
{%if now().strftime("%a") == 'Wed' or now().strftime("%a") == 'Sun'%} {%if now().strftime("%a") == 'Wed' or now().strftime("%a") == 'Sun'%}
Today is {{now().strftime("%A")}} and {{now().strftime("%A")}} is garbage day. Today is {{now().strftime("%A")}} and {{now().strftime("%A")}} is garbage day.
@@ -35,7 +36,17 @@
{%endif%} {%endif%}
{%- endmacro -%} {%- endmacro -%}
{{responsibilities()}} {{responsibilities()}}
Inside the house, it is {{ states.climate.downstairs.attributes["current_temperature"]}} degrees with around {{states('sensor.downstairs_thermostat_humidity')}} percent humidity. Outside, it is going to be {{states('sensor.dark_sky_minutely_summary')}}
{%- macro inside_weather() -%}
Inside the house, it is {{ states.climate.downstairs.attributes["current_temperature"]}} degrees with around {{states('sensor.downstairs_thermostat_humidity')}} percent humidity.
{%- endmacro -%}
{{inside_weather()}}
{%- macro outside_weather() -%}
Outside, it is going to be {{states('sensor.dark_sky_minutely_summary')}}
{%- endmacro -%}
{{outside_weather()}}
{% if is_state('cover.large_garage', 'open') -%} {% if is_state('cover.large_garage', 'open') -%}
Also, The Large Garage Door is still open Also, The Large Garage Door is still open
{% endif -%} {% endif -%}
@@ -43,12 +54,14 @@
{% if is_state('cover.large_garage', 'open') -%}and {% if is_state('cover.large_garage', 'open') -%}and
{%- endif %} The small Garage Door is still open. {%- endif %} The small Garage Door is still open.
{% endif %} {% endif %}
{%- macro lights_status() -%}
. There are . There are
{% for state in states.light if state.state == 'on' -%} {% for state in states.light if state.state == 'on' -%}
{%- if loop.last -%} {%- if loop.last -%}
{{ loop.index }} {{ loop.index }}
{%- endif -%} {%- endif -%}
{%- endfor %} lights on right now." {%- endfor %} lights on right now.
{% set comma = joiner(', ') %} The {% set comma = joiner(', ') %} The
{% for group in states.group|groupby('state') -%} {% for group in states.group|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on' and entity.name.split(' ')[1]|lower == 'lights' and entity.name.split(' ')[0]|lower != 'all' and entity.name.split(' ')[0]|lower != 'interior' -%} {%- for entity in group.list if entity.state == 'on' and entity.name.split(' ')[1]|lower == 'lights' and entity.name.split(' ')[0]|lower != 'all' and entity.name.split(' ')[0]|lower != 'interior' -%}
@@ -56,3 +69,5 @@
{{ entity.name }} {{ entity.name }}
{%- endfor -%} {%- endfor -%}
{%- endfor %} {%- endfor %}
{%- endmacro -%}
{{lights_status()}}"

View File

@@ -8,7 +8,7 @@ Weather:
- sensor.dark_sky_minutely_summary - sensor.dark_sky_minutely_summary
# - sensor.dark_sky_nearest_storm_distance # - sensor.dark_sky_nearest_storm_distance
- sensor.dark_sky_precip_intensity - sensor.dark_sky_precip_intensity
- sensor.dark_sky_precip_intensity_max - sensor.dark_sky_daily_max_precip_intensity
- sensor.dark_sky_wind_speed - sensor.dark_sky_wind_speed
- sensor.dark_sky_humidity - sensor.dark_sky_humidity
- sensor.dark_sky_temperature - sensor.dark_sky_temperature