In pseudocode I mean this (it’s a bit extreme, but I think illustrative)
trigger:
- platform: state
entity_id: group. Inhabitants
to: on
variables:
action: close
- platform: numeric_state
entity_id: sensor. Irradiance
above: 400
variables:
action: close
- platform: state
entity_id: timer.blinds_hold
state: idle
variables:
action: close
- platform: state
entity_id: sensor.sun_in_window
state: "on"
variables:
action: close
condition:
- condition: state
entity_id: group. Inhabitants
to: on
- condition: numeric_state
entity_id: sensor.irradiance
above: 400
- condition: state
entity_id: timer.blinds_hold
state: idle
- condition: state
entity_id: sensor.sun_in_window
state: "on"
action:
- service: "cover.{{action}}_cover"
entity_id: cover. Room
- service: timer.start
entity_id: timer.blinds_hold
data:
time: 0:05:00
I only want the triggers to fire if all the other sensors are int the correct state, so I have to repeat the triggers as a condition. I then may want to add an automation for closing the blinds when any of the four entities goes to a false state, so I swap out the condition key for a choose action.
Like you say, I’m creating a fake binary_sensor inside the automation, but I don’t really want to define new sensors every time I want to do something complex like this (and then worry about not writing them to the database etc). So the way that I am actually dealing with this now is just by using a template trigger with the four conditions anded together:
trigger:
- platform: template
value_template: "{{is_state('group,inhabitants','on') and state('sensor.irradiance')|float<400
and is_state('timer.blind_hold','idle') and is_state('sensor.sun_in_window','on')}}"
....
and then a notted version of the same for the closing.
This is fine for me at this level, but the moment you start adding time conditions (schedule), worrying about floats and defaults, etc this just gets very complex for the normal user and is the reason that other trigger platforms exist in the first place.
I think though that this level of complexity is kind of usual for many situations if you try not to have the same automation action code multiple times with different triggers/conditions. Maybe that’s my original sin. But I have a similar problem with my heating automations where the action is long, because I have to go through switching the radiators on/off in some particular sequence etc. You could say then that that should be an external script.
In any case, I would suggest that we could have a new platform that just tested if all conditions are satisfied and only fired when all are true. Something like
trigger:
- platform: trigger_when_all
trigger_conditions:
- condtion1:
- condition2:
- condtion3:
....