Add Group Toggle Script
This commit is contained in:
@@ -1 +1,31 @@
|
|||||||
# System Package
|
# 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 }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user