Files
Home-AssistantConfig/config/script/speech_processing.yaml
Carlo Costanzo 4457dc0bcd Refactor automation configurations and enhance documentation
- Updated guest_mode.yaml to clarify guest mode announcements and added a related issue reference.
- Enhanced night_watchdog.yaml with additional conditions for vacation mode and house sitter presence.
- Improved sunset_turn_on.yaml by refining action sequences and adding vacation presence logic.
- Expanded admin_sections.yaml to include new tiles for front door package detection and related inputs.
- Removed obsolete media player from media_players.yaml and updated switches.yaml to reflect new outdoor seasonal switch IDs.
- Enhanced home_modes.yaml and README.md to clarify home mode toggles and their usage.
- Updated docker_infrastructure.yaml to improve container outage notifications and streamline maintenance checks.
- Enhanced LLM Vision package to include front door package detection and related automation triggers.
closed https://github.com/CCOSTAN/Home-AssistantConfig/issues/793
2026-03-23 10:13:50 -04:00

100 lines
2.8 KiB
YAML
Executable File

#-------------------------------------------
# Speech Processing Script
# Description: Sends notifications to ChromeCast Audio devices
#
# Features:
# - Operates during specified hours
# - Activates when family is home or guest/vacation mode is on
# - Adjustable volume based on time of day
#
# Usage:
# action:
# service: script.speech_engine
# data:
# media_player: [target_media_player]
# speech_message: [message_to_speak]
#
# Original Repo: https://github.com/CCOSTAN/Home-AssistantConfig
# Follow me on https://www.vcloudinfo.com/click-here
#-------------------------------------------
speech_processing:
mode: queued
sequence:
- event: openai_instructions_sent
event_data:
instructions: "{{ speech_message | striptags }}"
- 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: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: group.bed
state: 'off'
- condition: time
after: '08:00:00'
before: '22: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
- service: media_player.volume_set
data:
entity_id: >
{{ media_player }}
volume_level: >-
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
0.2
{% elif now().strftime('%H')|int > 12 and now().strftime('%H')|int < 20 %}
0.3
{% else %}
0.2
{% endif %}
- service: conversation.process
data:
agent_id: conversation.openai_conversation
text: >-
{{ speech_message }}
response_variable: agent
- service: tts.cloud_say
data:
entity_id: media_player.livingroomCC
options:
voice: JennyNeural
message: >-
{{ agent.response.speech.plain.speech }}
cache: false
- event: openai_response
event_data:
response: "{{ now().strftime('%B %d,%Y %-I:%M %p') }} {{ agent.response.speech.plain.speech }}"
- service: input_boolean.turn_off
data:
entity_id:
- input_boolean.alert_mode
- input_boolean.lastmsg