Webhook not working to change input select option

I’m trying to create a webhook from ifttt to change an input select mode to see if a window has been openend. I have succesfully created an ifttt service to turn on the lights when the action happens but can’t get it to work when i change the code to change an input select.

ifttt

{
  "action": "call_service",
  "service": "input_select.select_option", 
  "entity_id": "input_select.slaapkamerraam",
  "option": "Open"
}

HA config:

automation:
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'

Anyone willing to help me with getting this automation/code to work?

Thanks!

I don’t think you’ll be able to create a blanket IFTTT service that will cover all service types in home assistant. That appears to be what you are trying to do. It won’t work because every service requires different data. You can’t template a data field, only a data fields result.

Anyways to get your exact service working…

automation:
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      option: '{{ trigger.event.data.option }}'

Personally, knowing the limitation described above, I would change my data to this:

ifttt

{
  "action": "select_option",
  "entity_id": "input_select.slaapkamerraam",
  "option": "Open"
}

automation

automation:
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: select_option
  action:
    service: input_select.select_option
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      option: '{{ trigger.event.data.option }}'
1 Like

Thanks for the information, your solution worked like a charm!