-
-
Notifications
You must be signed in to change notification settings - Fork 505
/
last_message.yaml
executable file
·69 lines (59 loc) · 1.76 KB
/
last_message.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
#-------------------------------------------
homeassistant:
customize:
input_boolean.lastmsg:
friendly_name: 'Repeat Message'
icon: mdi:repeat-once
#-------------------------------------------
input_boolean:
lastmsg:
name: Last Message
initial: off
#-------------------------------------------
template:
- trigger:
platform: event
event_type: openai_instructions_sent
sensor:
- name: "openai_instructions"
unique_id: openai_instructions
state: "on"
attributes:
instructions: "{{ trigger.event.data.instructions }}"
- trigger:
platform: event
event_type: openai_response
sensor:
- name: "openai_response"
unique_id: openai_response
state: "on"
attributes:
response: "{{ trigger.event.data.response }}"
##############################################################################
### Automations -
##############################################################################
automation:
- alias: 'Repeat Last Message'
id: a57b487c-e7dd-440e-b78b-08704ded8458
trigger:
- platform: state
entity_id: input_boolean.lastmsg
to: 'on'
action:
- service: tts.cloud_say
entity_id:
- media_player.livingroomCC
# - media_player.entry_alarm_panel
# - media_player.bedroom_alarm_panel
data:
options:
voice: JennyNeural
message: >-
"{{ state_attr('sensor.openai_response', 'response') }}"
cache: false
- service: input_boolean.turn_off
entity_id:
- input_boolean.lastmsg