Created
October 22, 2023 08:17
-
-
Save andycb/dbc463d4e95458a63d905c397901b3be to your computer and use it in GitHub Desktop.
Home Assistant Clock Timer Sentence Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Clock Timer | |
trigger: | |
- platform: conversation | |
command: | |
- create [a] timer [for] {minutes} minute[s] and {seconds} second[s] | |
- create [a] timer [for] {seconds} second[s] | |
- create [a] timer [for] {minutes} minute[s] | |
condition: [] | |
action: | |
- variables: | |
totalSeconds: |- | |
{% set seconds = 0 -%} | |
{% set minutes = 0 -%} | |
{% set hours = 0 -%} | |
{% if trigger.slots.seconds is defined -%} | |
{% set seconds = int(trigger.slots.seconds, 0) -%} | |
{% endif -%} | |
{% if trigger.slots.minutes is defined %} | |
{% set minutes = (int(trigger.slots.minutes, 0) * 60) -%} | |
{% endif -%} | |
{% if trigger.slots.hours is defined %} | |
{% set hours = (int(trigger.slots.hours, 0) * 3600) -%} | |
{% endif -%} | |
{% set total = (seconds + minutes + hours) -%} | |
"{{ total }}" | |
- service: notify.notify | |
data: | |
data: {} | |
message: >- | |
"Timer set for {{ totalSeconds }}secs. | |
{{seconds}},{{minutes}},{{hours}}" | |
- service: number.set_value | |
data: | |
value: "{{ totalSeconds }}" | |
target: | |
entity_id: number.cuckoo_clock_timer | |
enabled: true | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: "{{ totalSeconds }}" | |
milliseconds: 0 | |
enabled: true | |
- service: light.turn_on | |
data: | |
rgb_color: | |
- 4 | |
- 109 | |
- 220 | |
target: | |
entity_id: light.cuckoo_clock_dial_colour | |
enabled: true | |
- type: turn_on | |
device_id: cab869c8c01d33d3524e2926283cb008 | |
entity_id: 626bf26916f8bb1ea148b7213323e718 | |
domain: switch | |
enabled: true | |
mode: restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment