I’m struggling to get following working and based on a few searches I did on both Hass and Node RED I fear it’s not possible in an easy way. There is no single main trigger, so I cannot use the other states just as conditions.
I have a set of states, e.g.
person 1
person 2
time of day
TV
lights
prevent auto away
And I have three home away states: home, sleep, away
for home to activate following should be the case:
person 1 or person 2 home
time of day: between 7:00 & 0:00
TV: can be anything
lights: can be anything
prevent auto away: can be anything
for sleep to activate following should be the case:
person 1 or person 2 home
time of day: between 0:00 & 7:00
TV: off
lights: off
prevent auto away: can be anything
for away to activate following should be the case:
person 1 and person 2 away
time of day: can be anything
TV: can be anything
lights: can be anything
prevent auto away:
In short: Create a template sensor and for the value template, have if/ifelse/else check for each of the situations you’ve described.
For example (not actual code, just so you get the idea):
{% if person1 or person2 at home and time is between 7-0:00 %}
home
{% elseif ℅}
…
Then just use the state change of your template sensor as a trigger