From dd8fef251c3c5211762de2be73055a9696483b7c Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 19 Jul 2023 21:55:39 -0400 Subject: [PATCH] First adventures into the world of Assist --- custom_sentences/en/computers.yaml | 34 ++++++++++++++++++++++++++++++ custom_sentences/en/media.yaml | 22 +++++++++++++++++++ custom_sentences/en/responses.yaml | 7 ++++++ packages/assist.yaml | 27 ++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 custom_sentences/en/computers.yaml create mode 100644 custom_sentences/en/media.yaml create mode 100644 custom_sentences/en/responses.yaml create mode 100644 packages/assist.yaml diff --git a/custom_sentences/en/computers.yaml b/custom_sentences/en/computers.yaml new file mode 100644 index 0000000..001c153 --- /dev/null +++ b/custom_sentences/en/computers.yaml @@ -0,0 +1,34 @@ +language: "en" + +intents: + BootComputers: + data: + - sentences: + - "{action} the computer for {person}" + - "{action} {person}'s computer" + +lists: + person: + values: + - in: "tony" + out: "tony_desktop" + - in: "tina" + out: "tina_desktop" + - in: "christina" + out: "tina_desktop" + - in: "kallen" + out: "kallen_desktop" + - in: "collin" + out: "kallen_desktop" + action: + values: + - in: "boot" + out: "wake" + - in: "boot up" + out: "wake" + - in: "turn on" + out: "wake" + - in: "shut down" + out: "shutdown" + - in: "turn off" + out: "shutdown" diff --git a/custom_sentences/en/media.yaml b/custom_sentences/en/media.yaml new file mode 100644 index 0000000..aa6dc2d --- /dev/null +++ b/custom_sentences/en/media.yaml @@ -0,0 +1,22 @@ +language: "en" + +intents: + SetVolume: + data: + - sentences: + - "(set|change) {media_player} volume to {volume} [percent]" + - "(set|change) [the] volume for {media_player} to {volume} [percent]" + +lists: + media_player: + values: + - in: "living room tv" + out: "media_player.living_room_tv" + - in: "basement tv" + out: "media_player.basement_tv" + - in: "master bedroom tv" + out: "media_player.master_bedroom_firetv" + volume: + range: + from: 0 + to: 100 \ No newline at end of file diff --git a/custom_sentences/en/responses.yaml b/custom_sentences/en/responses.yaml new file mode 100644 index 0000000..d8664fd --- /dev/null +++ b/custom_sentences/en/responses.yaml @@ -0,0 +1,7 @@ +language: "en" +responses: + intents: + HassTurnOn: + default: "I have turned on the {{ slots.name }}" + HassTurnOff: + default: "I have turned off the {{ slots.name }}" \ No newline at end of file diff --git a/packages/assist.yaml b/packages/assist.yaml new file mode 100644 index 0000000..bfb42c5 --- /dev/null +++ b/packages/assist.yaml @@ -0,0 +1,27 @@ +intent_script: + SetVolume: + action: + service: "media_player.volume_set" + data: + entity_id: "{{ media_player }}" + volume_level: "{{ volume / 100.0 }}" + speech: + text: "Volume changed to {{ volume }}" + + BootComputers: + action: + service: "script.{{person}}_{{action}}" + speech: + text: > + {% if person == "tony_desktop" %} + {% set computer = "tony's computer" %} + {% elif person == "tina_desktop" %} + {% set computer = "tina's computer" %} + {% elif person == "kallen_desktop" %} + {% set computer = "collin's computer" %} + {% endif %} + {% if action == "wake" %} + {{ computer }} is now booting up + {% elif action == "shutdown" %} + {{ computer }} is shutting down + {% endif %} \ No newline at end of file