Not sure how to properly configure 3 similar automations

I have been tinkering about with my first automation, and got to a point where I have it working as expected.

The automation is a very common one where I have a motion sensor, and based on some conditions like time/illuminance, it’s going to turn the light on/off in a specific way.

This automation does that for my hallway downstairs. Now I want to create the ‘exact same’ automation but for my hallways on floor 1 and 2.

This would mean I’d have to change the motionsensor, light, and input_boolean helper.
What would be the ‘proper’ way of handling this? I could just duplicate it twice and replace it, but I feel like that is not a good way of going about this.

alias: Hal Motion
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.hal_motionsensor_occupancy
    to: "on"
    id: motion_on
  - trigger: state
    entity_id:
      - binary_sensor.hal_motionsensor_occupancy
    to: "off"
    id: motion_off
    for:
      seconds: 45
conditions: []
actions:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id:
                  - motion_on
              - condition: or
                conditions:
                  - condition: numeric_state
                    entity_id: sensor.hal_motionsensor_illuminance
                    below: 3000
                  - condition: state
                    entity_id: input_boolean.fadinglight_hal
                    state: "on"
        sequence:
          - if:
              - condition: time
                after: "08:00:00"
                before: "23:00:00"
            then:
              - action: light.turn_on
                data:
                  color_temp: 400
                  brightness: 200
                  transition: 1
                target:
                  device_id: 7ca63b6e63913d8ca702311ec3270954
            else:
              - action: light.turn_on
                data:
                  color_temp: 400
                  brightness: 30
                  transition: 1
                target:
                  device_id: 7ca63b6e63913d8ca702311ec3270954
          - action: input_boolean.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.fadinglight_hal
      - conditions:
          - condition: trigger
            id:
              - motion_off
        sequence:
          - action: light.turn_off
            metadata: {}
            data:
              transition: 15
            target:
              device_id: 7ca63b6e63913d8ca702311ec3270954
          - action: input_boolean.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.fadinglight_hal
mode: restart

It could be done with templating, but you might run into some weird edge cases where the restart mode causes issues if you try to put all three areas into a single automation.

What you have described is one of the main reasons for the existence of Blueprints, reducing code maintenance and overhead for simialr automations. Building them is not generally something that would be recommended to a new user, but it’s not that hard if you are comfortable with using YAML to build automations.

Blueprints seem to be exactly what I need here indeed.
The only problem I see at the moment is that Blueprints can’t dynamically create helpers, which my automation uses.