Passing an input_number from ifttt

EDIT:
I’ve figured out my problem, but not my solution. I have my ifttt automation as follows:

- alias: automate_ifttt
  initial_state: true
  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 }}'
##        value: '{{ trigger.event.data.value }}'

The last line is the issue, if I don’t have that line there, my lights work fine, but I can’t set a numeric value. If I uncomment that line, then I can set numeric values, but my lights stop working as they don’t pass a “value” and I get the following error in my logs:

2019-07-31 21:44:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1130, in async_call
    processed_data = handler.schema(service_data)
  File "/srv/homeassistant/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/srv/homeassistant/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/srv/homeassistant/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['value']

Any idea how to make this automation more flexible so I can use it for both light.turn_on AND input_number.set_value without either one breaking?

– old post below –
I’m trying to pass a numeric value from ifttt to a home assistant input_number, but it doesn’t seem to go, and I get the following error in my log each time:

2019-07-31 21:18:22 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.automate_ifttt. Invalid data for call_service at pos 1: required key not provided @ data[‘value’]

in ha I have the webhook integration configured, and it is confirmed working to turn on/off lights, in ifttt I have:
URL: (this is correct as if it wasn’t, I wouldn’t get the log entry, I’ve also confirmed this works for simple toggles like turning on or off lights)
method: POST
Content Type: application/json
body:

{ “action”: “call_service”, “service”: “input_number.set_value”, “entity_id”:“input_number.guest_entered”, “value”:“1234”}

As far as I can tell, this SHOULD set the input_number.guest_entered to a value of 1234, but instead the value remains zero, and I get the error listed above.

HA version is 0.96.5

I have also tried the services tab within ha to set it using service input_number.set_value, entity input_number.guest_entered and service data:

{
“entity_id”: “input_number.guest_entered”, “value”:“0000”
}

and that works exactly as it should, so I’m not sure why the ifttt doesn’t work.

Anyone have any ideas?

SOLVED

Ok, I figured it out, the trick is to have 2 separate IFTTT automations, one for things with values, another for ones without, these can be differentiated by changing the “action” line in the trigger section, and then of course changing the IFTTT command to match.

Hope this helps someone else who may be having the same issue I was.

Gday,

I’m trying to do the same thing but I cant see how to have two automations for IFTTT. Would you mind sharing your automation code?

Cheers

Here are the automations in home assistant:

#############################################################################################
###
### Required Automation to get IFTTT to connect, there are 2 different automations,
### the first is for services without values (turn_on/turn_off/etc), and the second
### is for services that require a value as well. Passing either type of trigger to 
### the wrong automation target (call_service vs call_service_num) will result in
### an error message in homeassistant.log and a failure of the automation to execute
###
#############################################################################################

- alias: automate_ifttt
  initial_state: true  
  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 }}'


- alias: automate_ifttt_num
  initial_state: true  
  trigger:
    - platform: event
      event_type: ifttt_webhook_received
      event_data:
        action: 'call_service_num'
  action:
    - service_template: '{{ trigger.event.data.service }}'
      data_template:
        entity_id: '{{ trigger.event.data.entity_id }}'
        value: '{{ trigger.event.data.value }}'

Then your IFTTT recipes will post an action of “call_service” if you just want to turn something on or off, or “call_service_num” if you need to pass a value to it.

Ahh, you differentiate by the action: in th eevnt_data. Cool. I got same working by using a condition to check the action. Yours is the correct way to do it. Cheers