Last active
February 26, 2024 17:20
-
-
Save Didgeridrew/03dbb43963000ce222b9194f382e45c0 to your computer and use it in GitHub Desktop.
Entrained Input_Booleans
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
### You can list the booleans in the template to make setup a little easier. | |
alias: Entrained Booleans (only 1 on at a time) | |
description: '' | |
trigger: | |
- platform: state | |
entity_id: | |
- input_boolean.test_bool_1 | |
- input_boolean.test_bool_2 | |
- input_boolean.test_bool_3 | |
to: 'on' | |
condition: [] | |
action: | |
- service: input_boolean.turn_off | |
target: | |
entity_id: '{{ inactive_bools }}' | |
variables: | |
inactive_bools: >- | |
{{ expand('input_boolean.test_bool_1', 'input_boolean.test_bool_2', 'input_boolean.test_bool_3') | |
| rejectattr('entity_id', 'eq', trigger.to_state.entity_id) | |
| map(attribute='entity_id') | list -}} | |
mode: single | |
### Or you can also put the booleans into a group to make the template a little easier to read. | |
alias: Entrained Booleans (only 1 on at a time) | |
description: '' | |
trigger: | |
- platform: state | |
entity_id: | |
- input_boolean.test_bool_1 | |
- input_boolean.test_bool_2 | |
- input_boolean.test_bool_3 | |
to: 'on' | |
condition: [] | |
action: | |
- service: input_boolean.turn_off | |
target: | |
entity_id: '{{ inactive_bools }}' | |
variables: | |
inactive_bools: >- | |
{{ expand(states.group.test_bools) | |
| rejectattr('entity_id', 'eq', trigger.to_state.entity_id) | |
| map(attribute='entity_id') | list -}} | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment