Add Group Toggle Script

This commit is contained in:
2023-11-29 10:30:09 -08:00
parent efe9d73117
commit a308a9d423

View File

@@ -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 }}"