42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
- id: test_id
|
|
alias: HassTurnOn/Off with Duration
|
|
description: ""
|
|
trigger:
|
|
- platform: conversation
|
|
command:
|
|
- "[turn] on [{area} {name}|{name} [in {area}]] for {time}"
|
|
- "[turn] [{area} {name}|{name} [in {area}]] [to] on for {time}"
|
|
id: "on"
|
|
- platform: conversation
|
|
command:
|
|
- "turn off [{area} {name}|{name} [in {area}]] for {time}"
|
|
- "[turn] [{area} {name}|{name} [in {area}]] [to] off for {time}"
|
|
id: "off"
|
|
condition: []
|
|
action:
|
|
- service: conversation.process
|
|
data:
|
|
text: "{{ trigger.sentence|replace(trigger.slots.time,'')|replace('for', '')|trim }}"
|
|
agent_id: conversation.home_assistant
|
|
- variables:
|
|
step_2: "{{ 'off' if trigger.id|bool else 'on'}}"
|
|
- delay:
|
|
milliseconds: 250
|
|
- service: conversation.process
|
|
data:
|
|
agent_id: conversation.home_assistant
|
|
text: |
|
|
{{ trigger.sentence|replace('turn on','turn '~step_2)|replace('turn off','turn '~step_2)
|
|
|replace('on for',step_2~' in')|replace('off for',step_2~' in')|replace('for', 'in')|trim }}
|
|
mode: single
|
|
|
|
|
|
service: media_player.play_media
|
|
target:
|
|
entity_id: media_player.onju_voice_02_onju_voice_02
|
|
data:
|
|
announce: true
|
|
media_content_id: >-
|
|
https://soundboardguy.com/wp-content/uploads/2022/09/we-are-the-champions-copia.mp3
|
|
media_content_type: audio/mpeg
|