Create automation using more inputs and conditions

Hi all,
I am trying to make an automation which seems quite complicated to me and need some help.

Prerequisites:
I have 4 switches (sw1, sw2,sw3 and sw4) which should be used as triggers and a 5th switch called swP which will change the state based on some conditions like:

1 - when all (sw1, sw2, sw3 and sw4) are off, then swP should go off as well.
2 - when one of the 4 goes on (no matter which one goes first on), then swP start with a 2 min delay
3 - while at least one of sw1-4 is on , then swP is on
4 - if swP was off for more than 10 days, then make it on for 1 hour

Thank you in advance for any help

Make four different automations to start with, to make sure you’ve got the logic right (for example, isn’t requirement 3 covered by requirement 2?). Let it run for a couple of days, then if everything looks OK think about something more elegant. Or not. There’s no real overhead in separate automations and they’re often easier to maintain.

Put these in a group :

I managed to make it work for turn off the pump but I have an issue with delay when I want to start

- id: 'distr-mansarda-on-pompa'
  alias: On pompa distr mansarda
  description: On pompa
  trigger:
    - platform: state
      entity_id: switch.c_camara
      to: 'on'
    - platform: state
      entity_id: switch.c_dressing
      to: 'on'
    - platform: state
      entity_id: switch.c_hol
      to: 'on'
    - platform: state
      entity_id: switch.c_living
      to: 'on'    
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: switch.c_camara
        state: 'on'
      - condition: state
        entity_id: switch.c_dressing
        state: 'on'
      - condition: state
        entity_id: switch.c_hol
        state: 'on'
      - condition: state
        entity_id: switch.c_living
        state: 'on'
  action:
  - entity_id: switch.pompa
#    delay: 00:01:00
    service: switch.turn_on

if I uncomment delay does not work at all, so probably is added wrong…anyone know how to add that delay to make it count?

Thanks

- id: 'distr-mansarda-on-pompa'
  alias: On pompa distr mansarda
  description: On pompa
  trigger:
    - platform: state
      entity_id: switch.c_camara
      to: 'on'
    - platform: state
      entity_id: switch.c_dressing
      to: 'on'
    - platform: state
      entity_id: switch.c_hol
      to: 'on'
    - platform: state
      entity_id: switch.c_living
      to: 'on'    
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: switch.c_camara
        state: 'on'
      - condition: state
        entity_id: switch.c_dressing
        state: 'on'
      - condition: state
        entity_id: switch.c_hol
        state: 'on'
      - condition: state
        entity_id: switch.c_living
        state: 'on'
  action:
  - delay: 00:01:00
  - entity_id: switch.pompa
    service: switch.turn_on