Simple automation check light condition

i have this simple script to turn lights on:

#- id: veranda
- alias: veranda_lampen
  trigger:
  - platform: state
    entity_id: sensor.lidl_deurbelknop_action
    to: pressed
  action:
    service: homeassistant.turn_on
    entity_id: switch.0x086bd7fffe5d0cfc_left

But, this only turns the lights on. How can i make this script so it checks if lights are on or off, and switches the lights on or off, depending on the state?

Use a *.toggle service.

  action:
    service: switch.toggle
    entity_id: switch.0x086bd7fffe5d0cfc_left