Introduce functions. Separate briefing as routine

This commit is contained in:
2020-03-05 14:56:56 +02:00
parent 232aa36894
commit cc6a972d0e
11 changed files with 129 additions and 415 deletions
-249
View File
@@ -1,249 +0,0 @@
elements:
- icon: 'mdi:fan'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
opacity: 0.7
top: 7%
tap_action: none
type: icon
- entity: sensor.purifier_speed
style:
border-color: 'rgb(34, 154, 210)'
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 6%
opacity: 1
pointer-events: none
text-shadow: 1px 1px black
top: 7%
transform: 'translate(0%,-50%)'
type: state-label
- icon: 'mdi:water-percent'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 20%
tap_action: none
type: icon
- attribute: humidity
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 100
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 20%
width: 60px
type: 'custom:circle-sensor-card'
units: '%'
- icon: 'mdi:thermometer'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 35%
tap_action: none
type: icon
- attribute: temperature
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 100
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 35%
width: 60px
type: 'custom:circle-sensor-card'
units: °C
- icon: 'mdi:bug'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 50%
tap_action: none
type: icon
- attribute: allergen_index
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 10
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 50%
width: 60px
type: 'custom:circle-sensor-card'
- entity: sensor.purifier_mode
prefix: 'Mode: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 80%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_target_humidity
prefix: 'Target humidity: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 85%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_water_level
prefix: 'Water level: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 90%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_brightness
prefix: 'Brightness: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 95%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_air_quality
style:
border-color: 'rgb(34, 154, 210)'
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 120%
font-weight: bold
left: 46%
opacity: 1
pointer-events: none
text-shadow: 1px 1px black
top: 22%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_pre_filter
prefix: 'Pre-filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 80%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_wick_filter
prefix: 'Wick filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 85%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_carbon_filter
prefix: 'Carbon filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 90%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_hepa_filter
prefix: 'HEPA filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 95%
transform: 'translate(0%,-50%)'
type: state-label
image: /local/images/purifier-image.png
type: picture-elements
@@ -5,15 +5,6 @@ input_boolean:
icon: mdi:chat
script:
# Predefined Speech
sarah_briefing:
alias: Speech - Briefing
sequence:
- service: script.talk
data_template:
message: !include ../templates/briefing.yaml
# Public Scripts
talk:
alias: Speech - Talk
sequence:
+11
View File
@@ -0,0 +1,11 @@
script:
routine_briefing:
alias: Routine - Briefing
sequence:
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.3
- service: script.talk
data_template:
message: !include ../../templates/briefing.yaml
+1 -5
View File
@@ -2,11 +2,7 @@ script:
routine_waking_up:
alias: Routine - Waking up
sequence:
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.3
- service: script.sarah_briefing
- service: script.routine_briefing
- delay: "00:00:25"
- service: script.talk
data:
+117 -117
View File
@@ -1,125 +1,125 @@
>-
{%- macro light_check() -%}
{%- if is_state('light.living_room_all_lights', 'on') -%}
There are
{%- for state in states.light if state.state == 'on' -%}
{%if loop.last %} {{ loop.index }} {% endif %}
{%- endfor -%}
lights on right now.
{%- else -%}
There are no lights on right now.
{%- endif -%}
{%- endmacro -%}
{%- macro window_check() -%}
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
The living room window is opened.
{%- endif -%}
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
The master bedroom window is opened.
{%- endif -%}
{%- endmacro -%}
{%- macro inside_weather() -%}
In the bedroom, it is {{ states('sensor.bedroom_weather_temperature') }} degrees with around {{ states('sensor.bedroom_weather_humidity') }} percent humidity.
{%- endmacro -%}
{%- macro outside_weather() -%}
Outside, in the next hour it's going to be {{ states('sensor.dark_sky_hourly_summary') }} {{ states('sensor.dark_sky_daily_summary') }}
{%- endmacro -%}
{%- macro iss() -%}
{% if is_state('binary_sensor.iss', 'on') -%}
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
{% endif -%}
{%- endmacro -%}
{%- macro moon() -%}
{%- if states.sensor.moon.state == 'Full moon' -%}
{{ [
"Check out the full moon tonight!",
"Hey look, There is the full moon.",
"The moon is huge! And full.",
"If you want to see the full moon, tonight is the night."
] | random }}
{%- macro light_check() -%}
{%- if is_state('light.living_room_all_lights', 'on') -%}
There are
{%- for state in states.light if state.state == 'on' -%}
{%if loop.last %} {{ loop.index }} {% endif %}
{%- endfor -%}
lights on right now.
{%- else -%}
There are no lights on right now.
{%- endif -%}
{%- endmacro -%}
{%- endmacro -%}
{%- macro inspirational_quote() -%}
{%- set inspirational_quote = [
"And one more thing, Life is about making an impact, make it a positive one.",
"And one more thing, Whatever the mind of man can conceive and believe, it can achieve.",
"And one more thing, Strive not to be a success, but rather to be of value.",
"And one more thing, I attribute my overall success to never giving or taking an excuse.",
"And one more thing, You miss one hundred percent of the shots you dont take.",
"And one more thing, The most difficult thing is the decision to act, the rest is merely tenacity.",
"And one more thing, Every strike brings me closer to the next home run.",
"And one more thing, Defining thepurpose is the starting point of all achievement.",
"And one more thing, Life is not about getting and having, it's about giving and being.",
"And one more thing, We become what we think about.",
"And one more thing, Life is ten percent what happens to you and ninety percent of how you react to it.",
"And one more thing, The most common way people give up their power is by thinking they do not have any.",
"And one more thing, The mind is everything. What you think, you will become. ",
"And one more thing, The best time to plant a tree was twenty years ago. The second best time is now.",
"And one more thing, An unexamined life is not worth living.",
"And one more thing, Eighty percent of success is showing up.",
"And one more thing, Your time is limited, so do not waste it living someone elses life.",
"And one more thing, Winning is not everything, but wanting to win is.",
"And one more thing, I am not a product of my circumstances. I am a product of my decisions.",
"And one more thing, You can never cross the ocean until you have the courage to lose sight of the shore.",
"And one more thing, Either you run the day, or the day runs you.",
"And one more thing, Whether you think you can or you think you cannot, you will be right.",
"And one more thing, The two most important days in your life are the day you are born and the day you find out why.",
"And one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power, and magic in it.",
"And one more thing, The best revenge is massive success.",
"And one more thing, The universe cant put good into your hands unless you let go of the bad.",
"And one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily.",
"And one more thing, Life shrinks or expands in proportion to ones courage.",
"And one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced.",
"And one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing.",
"And one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.",
"And one more thing, The only person you are destined to become is the person you decide to be.",
"And one more thing, Go confidently in the direction of your dreams. Live the life you have imagined.",
"And one more thing, Certain things catch your eye, but pursue only those that capture the heart.",
"And one more thing, Believe you can and you are halfway there.",
"And one more thing, Everything you have ever wanted is on the other side of fear.",
"And one more thing, Start where you are. Use what you have. Do what you can.",
"And one more thing, Fall seven times and stand up eight.",
"And one more thing, Everything has beauty, but not everyone can see.",
"And one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away.",
"And one more thing, Happiness is not something readymade. It comes from your own actions.",
"And one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on.",
"And one more thing, If the wind will not serve, take to the oars.",
"And one more thing, You can not fall if you do not climb. But theres no joy in living your whole life on the ground.",
"And one more thing, Too many of us are not living our dreams because we are living our fears.",
"And one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful.",
"And one more thing, If you want to lift yourself up, lift up someone else.",
"And one more thing, Be nice to others and nice things will happen to you.",
"And one more thing, It is nice to be important, but more important to be nice."
] -%}
{{inspirational_quote|random}}
{%- endmacro -%}
{%- macro window_check() -%}
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
The living room window is opened.
{%- endif -%}
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
The master bedroom window is opened.
{%- endif -%}
{%- endmacro -%}
{%- macro inside_weather() -%}
In the bedroom, it is {{ states('sensor.bedroom_weather_temperature') }} degrees with around {{ states('sensor.bedroom_weather_humidity') }} percent humidity.
{%- endmacro -%}
{%- macro outside_weather() -%}
Outside, it's going to be {{ states('sensor.dark_sky_hourly_summary') }} Expect {{ states('sensor.dark_sky_daily_summary') }}
{%- endmacro -%}
{%- macro iss() -%}
{% if is_state('binary_sensor.iss', 'on') -%}
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
{% endif -%}
{%- endmacro -%}
{%- macro moon() -%}
{%- if states.sensor.moon.state == 'Full moon' -%}
{{ [
"Check out the full moon tonight!",
"Hey look, There is the full moon.",
"The moon is huge! And full.",
"If you want to see the full moon, tonight is the night."
] | random }}
{%- endif -%}
{%- endmacro -%}
{%- macro inspirational_quote() -%}
{%- set inspirational_quote = [
"And one more thing, Life is about making an impact, make it a positive one.",
"And one more thing, Whatever the mind of man can conceive and believe, it can achieve.",
"And one more thing, Strive not to be a success, but rather to be of value.",
"And one more thing, I attribute my overall success to never giving or taking an excuse.",
"And one more thing, You miss one hundred percent of the shots you dont take.",
"And one more thing, The most difficult thing is the decision to act, the rest is merely tenacity.",
"And one more thing, Every strike brings me closer to the next home run.",
"And one more thing, Defining thepurpose is the starting point of all achievement.",
"And one more thing, Life is not about getting and having, it's about giving and being.",
"And one more thing, We become what we think about.",
"And one more thing, Life is ten percent what happens to you and ninety percent of how you react to it.",
"And one more thing, The most common way people give up their power is by thinking they do not have any.",
"And one more thing, The mind is everything. What you think, you will become. ",
"And one more thing, The best time to plant a tree was twenty years ago. The second best time is now.",
"And one more thing, An unexamined life is not worth living.",
"And one more thing, Eighty percent of success is showing up.",
"And one more thing, Your time is limited, so do not waste it living someone elses life.",
"And one more thing, Winning is not everything, but wanting to win is.",
"And one more thing, I am not a product of my circumstances. I am a product of my decisions.",
"And one more thing, You can never cross the ocean until you have the courage to lose sight of the shore.",
"And one more thing, Either you run the day, or the day runs you.",
"And one more thing, Whether you think you can or you think you cannot, you will be right.",
"And one more thing, The two most important days in your life are the day you are born and the day you find out why.",
"And one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power, and magic in it.",
"And one more thing, The best revenge is massive success.",
"And one more thing, The universe cant put good into your hands unless you let go of the bad.",
"And one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily.",
"And one more thing, Life shrinks or expands in proportion to ones courage.",
"And one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced.",
"And one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing.",
"And one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.",
"And one more thing, The only person you are destined to become is the person you decide to be.",
"And one more thing, Go confidently in the direction of your dreams. Live the life you have imagined.",
"And one more thing, Certain things catch your eye, but pursue only those that capture the heart.",
"And one more thing, Believe you can and you are halfway there.",
"And one more thing, Everything you have ever wanted is on the other side of fear.",
"And one more thing, Start where you are. Use what you have. Do what you can.",
"And one more thing, Fall seven times and stand up eight.",
"And one more thing, Everything has beauty, but not everyone can see.",
"And one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away.",
"And one more thing, Happiness is not something readymade. It comes from your own actions.",
"And one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on.",
"And one more thing, If the wind will not serve, take to the oars.",
"And one more thing, You can not fall if you do not climb. But theres no joy in living your whole life on the ground.",
"And one more thing, Too many of us are not living our dreams because we are living our fears.",
"And one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful.",
"And one more thing, If you want to lift yourself up, lift up someone else.",
"And one more thing, Be nice to others and nice things will happen to you.",
"And one more thing, It is nice to be important, but more important to be nice."
] -%}
{{inspirational_quote|random}}
{%- endmacro -%}
{% 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 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 %}
{{ [
"Here's your briefing for today!",
"Here's what's up!",
"Here are the updates today!"
]|random }}
{{ [
"Here's your briefing for today!",
"Here's what's up!",
"Here are the updates today!"
]|random }}
{{ inside_weather() }}
{{ outside_weather() }}
{{ light_check() }}
{{ window_check() }}
{{ iss() }}
{{ moon() }}
{{ inspirational_quote() }}
{{ inside_weather() }}
{{ outside_weather() }}
{{ light_check() }}
{{ window_check() }}
{{ iss() }}
{{ moon() }}
{{ inspirational_quote() }}
-35
View File
@@ -1,35 +0,0 @@
# WIP
title: Home
views:
- path: home
title: Home
panel: false
badges:
- entity: binary_sensor.updater
- entity: sun.sun
- entity: person.georgi
cards:
- entities:
- entity: device_tracker.tile_p_6e3c33752f24f417254c039040a984bd
- entity: device_tracker.tile_1bcb2b3021b9f96b
theme: default
title: Tiles
type: entities
- entity: weather.home
type: weather-forecast
- entity: light.pc_light
name: PC Light
type: light
- path: media
title: Media
cards:
- entity: media_player.living_room_chromecast
type: media-control
- entity: media_player.living_room_tv
type: media-control
- entity: media_player.spotify
type: media-control