Use webhook event as trigger with light sensor as condition

Hello
I’m trying to setup like this:

  • When I ask for turn on the lamp, hassio should check the light sensor
  • If light sensor =1 (lamp already ON by manual switch) so do nothing
  • If light sensor =0 (lamp currently OFF) so turn on the lamp

Can you please advise

- alias: Lamp ON
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data: "lamp1on"
  condition:
    platform: state
    entity_id: sensor.lamp
    to: "0"
  action:
        service: switch.turn_on
        entity_id: switch.lamp

The State Condition requires that you use state: not to:

Also, you need to correct the indentation for action.

- alias: Lamp ON
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data: "lamp1on"
  condition:
    platform: state
    entity_id: sensor.lamp
    state: "0"
  action:
    service: switch.turn_on
    entity_id: switch.lamp