Leaving Home Automation Help

Hi there, new to home assistant and am trying to get my head around how I could make my simple automation a little more advanced. At the moment my routine is triggered when the family group leaves home, this will turn any switches that are left on to off and set off my Roborock S5 vacuum cleaners if they haven’t been run that day. I would like it, that if the family group changes to home then the hoovers would return to the dock if they are still cleaning and resume where they left off when we leave again. repeat and rinse until the cleaning is finished. Is this even possible? If it is, it is a bit beyond my scope and I would require some help. Here is what I have so far.

alias: Leaving Home
description: ''
trigger:
  - platform: zone
    entity_id: person.james
    zone: zone.home
    event: leave
  - platform: zone
    entity_id: person.hannah
    zone: zone.home
    event: leave
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: group.family
            state: not_home
          - condition: state
            entity_id: sensor.vacuuming_time_today
            state: '0.0'
        sequence:
          - device_id: c726566132d3df5bce46d8465231f0c7
            domain: vacuum
            entity_id: vacuum.roborock_vacuum_s5_2
            type: clean
          - device_id: eb6d328b3e64faffbdb8a90a5cfb6448
            domain: vacuum
            entity_id: vacuum.roborock_vacuum_s5
            type: clean
          - service: switch.turn_off
            target:
              area_id:
                - bathroom
                - bedroom
                - guest_bedroom
                - hall
                - landing
                - kitchen
                - living_room
                - loft
                - nicole_s_bedroom
                - office
                - outside
                - toilet
                - utility
    default:
      - service: switch.turn_off
        target:
          area_id:
            - bathroom
            - bedroom
            - guest_bedroom
            - hall
            - landing
            - kitchen
            - living_room
            - loft
            - nicole_s_bedroom
            - office
            - outside
            - toilet
            - utility
mode: single

Many thanks for looking at this.

I think you need a new rule for when the family returns home. I don’t think it is possible to have the vaccum pause and resume, thus you need to start a new cleaning run.

I would recommend to have a look node red for creating your automations, but I think this is much up to the individual prorgammer.

That’s not what I am seeing in the automation you posted. It triggers when either person.james or person.hannah leave and not only when both have left (i.e. the “family group”). As long as just one person leaves, the automation’saction turns off all switches in the listed areas (even if the ones that are already off). It activates the vacuum cleaner only if both persons have left (i.e. “family group” is not_home)

I can help you achieve your goal but first I need you to clarify how you want it to work (the way you described or the way the posted automation works).

Hi and thanks for your help guys, the way I would like it to work is as it is in the routine, switch off the lights if only one of us leaves, switch of the lights and start the vacuums if no one is at home. Trying to get it to pass the GAF (Girlfriend Acceptance Factor). At the moment she is unhappy that the hoovers are going off while she is working from home. Just to be clear, I would like it to pause the hoovers and return them to their docks when one of us returns home, but only start cleaning again when both of us are not home. Many thanks for your help.