From a308a9d423add881cc953a048f5e2eda63e761ec Mon Sep 17 00:00:00 2001 From: "J.P. Krauss" Date: Wed, 29 Nov 2023 10:30:09 -0800 Subject: [PATCH] Add Group Toggle Script --- packages/system/system.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/system/system.yaml b/packages/system/system.yaml index 8c6d8f1..8ca74f3 100644 --- a/packages/system/system.yaml +++ b/packages/system/system.yaml @@ -1 +1,31 @@ # System Package + +# ----------------------------------------------------------------------------- +# System Scripts +script system: + toggle_group: + alias: Toggle Group (Generic) + description: Toggle the on/off state of a Group + fields: + entity_id: + name: Group Entity + description: Group entity to toggle + required: true + selector: + entity: + filter: + - domain: group + mode: queued + sequence: + - if: + - condition: template + value_template: > + {{ + entity_id is defined + and states(entity_id) != 'unknown' + and states[entity_id].domain == 'group' + }} + then: + - service: "homeassistant.turn_{{ iif(is_state(entity_id, 'off'), 'on', 'off') }}" + target: + entity_id: "{{ entity_id }}"