Asky82
(Asky82)
1
Dear all,
May I ask you what would be the best way to create a new bool Entity that rappresent in OR condition other Bool entity.
Use case:
I have the 8 valves and I would like to have one Boolean that is ON only if at least one of the valves is open.
Thanks you so much for your support!
Assume that your source entities are “input_boolean” (on/off).
Then an OR sensor could be like:
template:
- binary_sensor:
- name: my_test_boolean
state: >-
{{
is_state('input_boolean.test_boolean','on') or
is_state('input_boolean.test_boolean_2','on') or
is_state('input_boolean.test_boolean_3','on') or
...
is_state('input_boolean.test_boolean_8','on')
}}
Or, if names of source sensors have some pattern:
state: >-
{{
states.input_boolean |
selectattr('entity_id','search','input_boolean.test_boolean') |
selectattr('state','eq','on') |
list |
count > 0
}}
jeffcrum
(Jeff Crum)
3
Are they actually input_boolean? Or, as valves, are they on/off (switch)?
How about a Group Helper?
@jeffcrum’s suggestion to use a Group seems to be the most straightforward way.
From the docs:
In short, when any group member entity is on, the group will also be on.