Room Presence Automations not working

I am having issues with things working properly, i simply want things to turn on when there’s presence a room and turn off when there’s not, i’ve setup some extra complexity within my binary sensors so for example a sensor such as “Should turn on Light (Living Room)” which is only true if there’s both presence and the sun is at a certain height so they dont turn on during the day.

But i seem to have something messed up in the automation side as i get inconsistant results or they just done work i’ve rewritten them several times but still to no adeiu so posting the code here to see if anyone can suggest where i’ve gone wrong, thanks.

My Custom Binary Sensors:

-   name: Occupied (Living Room)
    state: >
      {{ 
            is_state('binary_sensor.motion_sensor_livingroom_occupancy', 'on')
         or is_state('binary_sensor.motion_sensor_computer_desk_occupancy', 'on')
      }}
    icon: >
      {% if is_state("binary_sensor.occupied_living_room)", "on") %}
        mdi:sofa-single
      {% else %}
        mdi:sofa-single-outline
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Occupied (Bedroom)
    state: >
      {{ 
            is_state('binary_sensor.motion_sensor_bedroom_occupancy', 'on')
      }}
    icon: >
      {% if is_state("binary_sensor.occupied_bedroom)", "on") %}
        mdi:bed-queen
      {% else %}
        mdi:bed-queen-outline
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Occupied (Kitchen)
    state: >
      {{ 
            is_state('binary_sensor.motion_sensor_kitchen_occupancy', 'on')
      }}
    icon: >
      {% if is_state("binary_sensor.occupied_kitchen)", "on") %}
        mdi:fridge
      {% else %}
        mdi:fridge-outline
      {% endif %}
    delay_off:
      seconds: 5

# Probably have to pair this up with a boolean that only changes when the front door magnetic sensor is changed aand hallway is occupied before it changes state to false
-   name: Occupied (Home)
    state: >
      {{ 
            is_state('binary_sensor.occupied_living_room', 'on')
         or is_state('binary_sensor.occupied_bedroom', 'on')
         or is_state('binary_sensor.occupied_kitchen', 'on')
         or is_state('binary_sensor.occupied_hallway', 'on')
      }}
    icon: >
      {% if is_state("binary_sensor.occupied_home)", "on") %}
        mdi:door-closed
      {% else %}
        mdi:door-closed-lock
      {% endif %}
    delay_off:
      seconds: 30
      
-   name: Is Dark Outside
    state: >
      {{ 
            state_attr('sun.sun', 'elevation')|float < 25
      }}
    icon: >
      {% if is_state("binary_sensor.is_dark_outside)", "on") %}
        mdi:sun
      {% else %}
        mdi:weather-night
      {% endif %}

-   name: Should turn on Light (Bedroom)
    state: >
      {{ 
             is_state('binary_sensor.occupied_bedroom', 'on')
         and state_attr('cover.blind_bedroom', 'current_position')|float < 75 
      }}
    icon: >
      {% if is_state("binary_sensor.should_turn_on_light_bedroom)", "on") %}
        mdi:lightbulb-auto
      {% else %}
        mdi:lightbulb-auto-outline
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Should Close Blinds
    state: >
      {{ 
             is_state('binary_sensor.occupied_living_room', 'on')
         and (
              is_state("binary_sensor.occupied_home)", "off")
           or is_state('binary_sensor.is_dark_outside', 'on')
           or state_attr('sun.sun', 'elevation')|float < 30
         )

      }}
    icon: >
      {% if is_state("binary_sensor.should_close_blinds)", "on") %}
        mdi:blinds
      {% else %}
        mdi:blinds-open
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Should turn on Light (Living Room)
    state: >
      {{ 
             is_state('binary_sensor.occupied_living_room', 'on')
         and (
              state_attr('cover.blind_living_room', 'current_position')|float < 75
           or is_state('binary_sensor.is_dark_outside', 'on')
         )
      }}
    icon: >
      {% if is_state("binary_sensor.should_turn_on_light_living_room)", "on") %}
        mdi:lightbulb-auto
      {% else %}
        mdi:lightbulb-auto-outline
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Should turn on Light (Kitchen)
    state: >
      {{ 
             is_state('binary_sensor.occupied_kitchen', 'on')
         and (
              state_attr('cover.blind_living_room', 'current_position')|float < 75
           or is_state('binary_sensor.is_dark_outside', 'on')
         )
      }}
    icon: >
      {% if is_state("binary_sensor.should_turn_on_light_kitchen)", "on") %}
        mdi:lightbulb-auto
      {% else %}
        mdi:lightbulb-auto-outline
      {% endif %}
    delay_off:
      seconds: 5
      
-   name: Should turn on Light (Hallway)
    state: >
      {{ 
             is_state('binary_sensor.occupied_hallway', 'on')
      }}
    icon: >
      {% if is_state("binary_sensor.should_turn_on_light_living_room)", "on") %}
        mdi:lightbulb-auto
      {% else %}
        mdi:lightbulb-auto-outline
      {% endif %}
    delay_off:
      seconds: 5

My Automations:

alias: Lighting and Blinds Off
description: ''
trigger:
  - platform: state
    entity_id: >-
      binary_sensor.should_close_blinds,binary_sensor.should_close_blinds,binary_sensor.should_turn_on_light_living_room,binary_sensor.should_turn_on_light_bedroom,binary_sensor.should_turn_on_light_kitchen,binary_sensor.should_turn_on_light_hallway
    from: 'On'
    to: 'Off'
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Living Room'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.living_room_off
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Bedroom'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.bedroom_off
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Kitchen'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.kitchen_off
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Hallway'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.hallway_off
    default: []
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.should_close_blinds
            state: ''
        sequence:
          - device_id: 7471505451e89c12763a06d8ceada3f0
            domain: cover
            entity_id: cover.blind_living_room
            type: set_position
            position: 100
    default: []
mode: parallel
max: 10


alias: Lighting and Blinds On
description: ''
trigger:
  - platform: state
    entity_id: >-
      binary_sensor.should_close_blinds,binary_sensor.should_turn_on_light_living_room,binary_sensor.should_turn_on_light_bedroom,binary_sensor.should_turn_on_light_kitchen,binary_sensor.should_turn_on_light_hallway
    from: 'Off'
    to: 'On'
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Living Room'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.living_room_on
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Bedroom'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.bedroom_on
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Kitchen'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.kitchen_on
    default: []
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ ''Hallway'' in trigger.to_state.attributes.friendly_name }}'
        sequence:
          - scene: scene.hallway_on
    default: []
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.should_close_blinds
            state: ''
        sequence:
          - device_id: 7471505451e89c12763a06d8ceada3f0
            domain: cover
            entity_id: cover.blind_living_room
            type: set_position
            position: 0
    default: []
mode: parallel
max: 10