Skip to content

Instantly share code, notes, and snippets.

@zsarnett
Last active February 24, 2022 04:02
Show Gist options
  • Save zsarnett/66804fc0fe2b4b98f10d2f33fe657c71 to your computer and use it in GitHub Desktop.
Save zsarnett/66804fc0fe2b4b98f10d2f33fe657c71 to your computer and use it in GitHub Desktop.
blueprint:
name: Send TTS to a speaker when motion is sensed once a day
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:
motion_entity:
name: Motion Device
description: The motion device that will trigger the automation
selector:
entity:
device_class: motion
text_to_speech:
name: Text to send
description: This is the text to send to the speaker via Text to Speech
selector:
text:
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 to send the TTS to
description: This will be the device the TTS is sent to when the motion is seen
selector:
entity:
domain: media_player
language:
name: Language to use for speech generation
default: "en-ca"
selector:
select:
options:
- "en-CA"
- "en"
gender:
name: Gender to use for the speech generation
default: "male"
selector:
select:
options:
- "male"
- "female"
variables:
entity_id: !input motion_entity
device_id: "{{ device_id(entity_id) }}"
trigger:
type: motion
platform: device
device_id: device_id
entity_id: !input motion_entity
domain: binary_sensor
condition:
- condition: time
before: !input end_time
after: !input start_time
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- 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
message: !input text_to_speech
language: !input language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment