From 4ca020a6dabef2e3bed03e644619d1e7029b71a9 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 18 Sep 2024 09:58:28 -0400 Subject: [PATCH] feat(hass): add pause and unpause voice commands for timers --- .../modules/home-assistant/docs/functions.nix | 81 +++++++++++++++++-- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/devices/homie/modules/home-assistant/docs/functions.nix b/devices/homie/modules/home-assistant/docs/functions.nix index 6eaa28ff..1466d3bd 100644 --- a/devices/homie/modules/home-assistant/docs/functions.nix +++ b/devices/homie/modules/home-assistant/docs/functions.nix @@ -87,14 +87,81 @@ in [ }; } + { + spec = { + name = "timer_pause"; + description = "Use this function to pause a timer in Home Assistant."; + + parameters = { + type = "object"; + + properties = { + timer_number = { + type = "string"; + description = "The number of the timer"; + enum = ["1" "2" "3"]; + }; + }; + + required = ["timer_number"]; + }; + }; + + function = { + type = "script"; + + sequence = [ + { + service = "script.assist_timerpause"; + + target.entity_id = ''{{ "timer.assist_timer" ~ timer_number }}''; + + data = { + timer_action = "pause"; + }; + } + ]; + }; + } + + { + spec = { + name = "timer_unpause"; + description = "Use this function to unpause or resume a timer in Home Assistant."; + + parameters = { + type = "object"; + + properties = { + timer_number = { + type = "string"; + description = "The number of the timer"; + enum = ["1" "2" "3"]; + }; + }; + + required = ["timer_number"]; + }; + }; + + function = { + type = "script"; + + sequence = [ + { + service = "script.assist_timerpause"; + + target.entity_id = ''{{ "timer.assist_timer" ~ timer_number }}''; + + data = { + timer_action = "resume"; + }; + } + ]; + }; + } + /* - TimerPause: - async_action: true - action: - - service: script.assist_TimerPause - data: - entity_id: "{{ entity_id }}" - timer_action: "{{ timer_action }}" TimerDuration: async_action: true action: