Last active
May 27, 2022 19:53
-
-
Save zsarnett/9be2c5d625a982d2d2c1fcf4b7a94b58 to your computer and use it in GitHub Desktop.
Custom Greeting from Motion Blueprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Jarvis Greets you in the morning when you trigger a motion sensor | |
description: > | |
This automation blueprint sends TTS to a Speaker when motion is sensed once a day. Meaning the automation will only run one time per day | |
domain: automation | |
input: | |
name: | |
name: Name you want Jarvis to call you (optional) | |
description: Jarvis will use this name to address you | |
default: '' | |
selector: | |
text: | |
motion: | |
name: Motion Device | |
description: This will be how you trigger Jarvis to tell you about your day | |
selector: | |
entity: | |
device_class: motion | |
weather: | |
name: Weather | |
description: Jarvis will tell you the current weather as well as the high and lows for the day | |
selector: | |
entity: | |
domain: weather | |
sun: | |
name: Sun (optional) | |
description: Jarvis will tell you when the sun rose and when the sun will set for the day | |
default: '' | |
selector: | |
entity: | |
domain: sun | |
calendar: | |
name: Calendar (optional) | |
description: Jarvis will check your calendar for the next event for the day | |
default: '' | |
selector: | |
entity: | |
domain: calendar | |
room_sensor: | |
name: Room Temperature Sensor (optional) | |
description: Jarvis will let you know what your room temperature is | |
default: '' | |
selector: | |
entity: | |
domain: sensor | |
device_class: temperature | |
start_time: | |
name: Time to start looking for motion | |
description: This will be the time the automation starts looking for motion | |
default: "07:00:00" | |
selector: | |
time: | |
end_time: | |
name: Time to stop looking for motion | |
description: This will be the time the automation stops looking for motion (Recommendation - 3-4 hours between start and end) | |
default: "11:00:00" | |
selector: | |
time: | |
speaker: | |
name: Speaker | |
description: The speaker you want Jarvis to speak on | |
selector: | |
entity: | |
domain: media_player | |
language: | |
name: Jarvis can take on any language you would like | |
default: "en-CA" | |
selector: | |
select: | |
options: | |
- "en-CA" | |
- "en" | |
gender: | |
name: Would you rather Jarvis be a male or female? | |
default: "male" | |
selector: | |
select: | |
options: | |
- "male" | |
- "female" | |
variables: | |
motion: !input motion | |
motion_device: "{{ device_id(motion) }}" | |
start_time: !input start_time | |
end_time: !input end_time | |
calendar: !input calendar | |
weather: !input weather | |
language: !input language | |
room_sensor: !input room_sensor | |
speaker: !input speaker | |
name: !input name | |
sun: !input sun | |
trigger: | |
type: motion | |
platform: device | |
domain: binary_sensor | |
device_id: motion_device | |
entity_id: !input motion | |
condition: | |
- condition: time | |
weekday: | |
- mon | |
- tue | |
- wed | |
- thu | |
- fri | |
- sat | |
- sun | |
before: !input end_time | |
after: !input start_time | |
- condition: template | |
value_template: "{{as_timestamp(this.attributes.last_triggered)|timestamp_custom('%-d') != as_timestamp(now())|timestamp_custom('%-d')}}" | |
action: | |
- service: tts.cloud_say | |
data: | |
entity_id: !input speaker | |
language: !input language | |
message: > | |
Good morning {{ name }}, Today it will be | |
{%- if state_attr(weather, 'forecast') is not none -%} | |
{%- if state_attr(weather, 'forecast')[0].detailed_description is defined and state_attr(weather, 'forecast')[0].detailed_description is not none-%} | |
{{ '' }} {{ state_attr(weather, 'forecast')[0].detailed_description -}} | |
{%- else -%} | |
{{ '' }} {{ state_attr(weather, 'forecast')[0].condition -}} | |
{%- endif -%} | |
{{ '' }} with a high of {{ int(state_attr(weather, 'forecast')[0].temperature, 0) }} degrees | |
{%- if "templow" in state_attr(weather, 'forecast')[0] AND state_attr(weather, 'forecast')[0].templow is not none -%} | |
{{ '' }} and a low of {{ int(state_attr(weather, 'forecast')[0].templow, 0) }} degrees. | |
{%- else -%} | |
. | |
{%- endif -%} | |
{%- if "precipitation_probability" in state_attr(weather, 'forecast')[0] AND state_attr(weather, 'forecast')[0].precipitation_probability is not none -%} | |
{{ '' }} There is a {{ int(state_attr(weather, 'forecast')[0].precipitation_probability, 0) }}% chance of rain. | |
{%- endif %} | |
{%- else -%} | |
{{ '' }} {{ states(weather) }} with a temperature of {{ int(state_attr(weather, 'temperature'), 0) }} degrees. | |
{%- endif %} | |
{%- if sun != '' -%} | |
{{ '' }} The sun rose {{ relative_time((as_timestamp(states[sun].last_changed) | timestamp_local) | as_datetime) }} ago and will set at | |
{{- '' }} {{ ((as_timestamp(state_attr(sun, "next_setting")) | timestamp_local) | as_datetime).strftime('%I:%M %p') }}. | |
{%- endif -%} | |
{%- if calendar != '' -%} | |
{{ '' }} Your next meeting is {{ state_attr(calendar, "message") }} at {{ ((as_timestamp(state_attr(calendar, "start_time")) | timestamp_local) | as_datetime).strftime('%I:%M %p') }}. | |
{%- endif -%} | |
{%- if room_sensor != '' -%} | |
{{ '' }} Your room temperature is currently at {{ int(states(room_sensor) | round, 0) }} degrees. | |
{%- endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment