Zone home - start script

To this automation I would like to add the condition that if in the case I am not at home both on holidays and working days, the script starts at 9.

- id: 'Luci piante matteo'
  alias: Luci piante matteo
  trigger:
    - platform: time
      at: '09:00:00'
    - platform: time
      at: '10:00:00'
  condition:
    - condition: zone
      entity_id: device_tracker.iphone_matteo
      zone: zone.home
    - condition: template
      value_template: >  
       {{ (is_state('binary_sensor.workday_sensor', 'on') and now().hour == 9) or
          (is_state('binary_sensor.workday_sensor', 'off') and now().hour == 10) }}
  action:
  - service: script.accendi_piante

You can create 2 separated automation, and use the Time condition with weekday.

Is it possible to do this in a single automation to optimize the code?

You could change your triggers to a template trigger and use if-elif-else statements to trigger the automation based on those conditions.

One example of automation?