Automation for internal camera

Hi, I would have an automation for toggling the recordings of my internal camera.
I would record from 00:00 to 06:00 always and if there’s no people at home, for that I have a group.family, for the switches I have:

  • switch.cucina_recordings
  • switch.sala_recordings
  • switch.garage_recordings

I tried this but if all of my family come at home after 00:00 it would turn off the recordings:

alias: "Frigate - Camere interne"
description: ""
trigger:
  - platform: state
    entity_id: group.family
  - platform: time
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ (trigger.platform == 'time' and trigger.to_state.state == '06:00') or (trigger.platform == 'state' and trigger.to_state.state == 'home') }}
        sequence:
          - service: switch.turn_off
            target:
              entity_id:
                - switch.cucina_recordings
      - conditions:
          - condition: template
            value_template: >-
              {{ (trigger.platform == 'time' and trigger.to_state.state == '00:00') or (trigger.platform == 'state' and trigger.to_state.state == 'not_home') }}
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.cucina_recordings
    default: []
mode: single

Any help would be apprecieted