Home-AssistantConfig/config/script/speech_processing.yaml

103 lines
3.2 KiB
YAML
Raw Normal View History

#####################################################################################################
2018-01-02 00:00:45 +00:00
###Script to actually send notifications to the ChromeCast Audios during normal hours and only when we are home! Call like this:
# action:
# service: script.speech_engine
# media_player:
# speech_message:
2018-01-02 00:00:45 +00:00
# # @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
######################################################################################################
speech_processing:
mode: queued
2018-01-02 00:00:45 +00:00
sequence:
- service: mqtt.publish
data:
2018-01-02 00:00:45 +00:00
topic: 'polly/lastmsg'
payload: "Message: {{ now().strftime('%-I') }}:{{ now().strftime('%M') }} {{ now().strftime('%p') }}. {{ speech_message | striptags | truncate(220)}}"
2018-01-02 00:00:45 +00:00
retain: true
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: group.family
state: 'home'
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: group.bed
state: 'off'
- condition: time
after: '08:00:00'
before: '20:00:00'
- condition: state
entity_id: input_boolean.alert_mode
state: 'on'
- condition: state
entity_id: input_boolean.speech_notifications
state: 'on'
- service: switch.turn_on
entity_id: switch.lr_amp
2018-01-02 00:00:45 +00:00
- service: media_player.volume_set
data:
entity_id: >
{{ media_player }}
2018-01-02 00:00:45 +00:00
volume_level: >-
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
0.2
2018-01-02 00:00:45 +00:00
{% elif now().strftime('%H')|int > 12 and now().strftime('%H')|int < 20 %}
0.3
2018-01-02 00:00:45 +00:00
{% else %}
0.2
2018-01-02 00:00:45 +00:00
{% endif %}
# - service: tts.amazon_polly_say
# data:
# entity_id: media_player.livingroomCC
# message: >-
# <speak>
# <amazon:auto-breaths>
# {{ speech_message }}
# </amazon:auto-breaths>
# </speak>
# cache: true
2018-09-27 14:16:52 +00:00
- service: conversation.process
data:
agent_id: conversation.openai_conversation
text: >-
Take the following system generated information and review and relay the information as yourself.
Here is the information:
{{ speech_message }}
response_variable: agent
- service: tts.cloud_say
data:
entity_id: media_player.livingroomCC
options:
voice: JennyNeural
2018-01-02 00:00:45 +00:00
message: >-
{{ agent.response.speech.plain.speech }}
cache: true
2018-01-02 00:00:45 +00:00
- service: mqtt.publish
data:
topic: 'polly/lastmsg_openai'
payload: "Message: {{ now().strftime('%-I') }}:{{ now().strftime('%M') }} {{ now().strftime('%p') }}. {{ agent.response.speech.plain.speech | striptags | truncate(220)}}"
retain: true
2018-01-02 00:00:45 +00:00
- service: input_boolean.turn_off
data:
entity_id:
- input_boolean.alert_mode
- input_boolean.lastmsg