How can i toggle a switch to turn on and off every 15 minutes between two times?

Two automations would be simplest.

- id: heatingleftbedroomday_on
  alias: Left Bedroom Heating On
  trigger:
    - platform: time_pattern
      minutes: 0
  condition:
    - condition: time
      after: '08:59'
      before: '18:01'
  action: 
    - service: switch.turn_on
      target:
        entity_id: switch.sonoff_second_house_left_bedroom
- id: heatingleftbedroomday_off
  alias: Left Bedroom Heating Off
  trigger:
    - platform: state
      entity_id: switch.sonoff_second_house_left_bedroom
      to: 'on'
      for:
        minutes: 15
  action: 
    - service: switch.turn_off
      target:
        entity_id: switch.sonoff_second_house_left_bedroom