Howdy,
Fairly new to home-assistant and getting into some more advanced activities that I know what I want to do, but can’t figure out how to implement the syntax.
I have an automation that is triggering on the status_changed type and then using a value condition to evaluate multiple variables. I have it working currently after testing multiple options, but only because I’ve eliminated the root of the issue I was facing which is nested conditions. Basically, how to use ‘and’ and ‘or’ in groups without bashing together the visual editor condition types.
For example:
variable1 and variable2 and (variable3 or variable 4)
What I tried, in many ways that would only be evaluated based on the first or variable listed. I tried paranthesis (as example above) in different formats to no avail.
Here is the curretly working And if (sensor and MACs have been redacted):
{{
is_state('input_boolean.redacted', 'off') and
(now() - states.input_boolean.redacted.last_changed).total_seconds() >= 60 | int and
trigger.event.data.new_state.attributes.ap_mac in ['mac1','mac2']
}}
Where really what I wanted to work (so that more nested conditions beyond this use case could be implemented was:
{{
is_state('input_boolean.redacted', 'off') and
(now() - states.input_boolean.redacted.last_changed).total_seconds() >= 60 | int) and
(trigger.event.data.new_state.attributes.ap_mac == 'mac1' or
trigger.event.data.new_state.attributes.ap_mac == 'mac2')
}}
I looked through the docs and other examples and couldn’t come up with anything. Don’t mind being told I’m a loser because my search didn’t work if you can provide said link.
TIA