I have many automations that already call this script. so I would prefer not to change it, however but will if I have to -
alias: Motion Detected
sequence:
- condition: template
value_template: “{{ is_state(enablement_input_selector_entity,‘Enabled’) }}” - service: timer.start
data:
duration: “{{ (states(timer_duration_entity)|int*60) }}”
target:
entity_id: “{{ timer_entity }}”
mode: parallel
max: 100
My main issue is, I am also trying to call the same script from IFTTT with this in the body of my ifttt webhook:
{
“action”:“call_service”, “service”:“script.turn_on”,
“entity_id”:“script.motion_detected”,
“enablement_input_selector_entity”:“input_select.den_automation_lamp_by_closet_is”,
“timer_duration_entity”:“input_number.den_adjust_couch_lamp_by_closet_timer”,
“timer_entity”:“timer.den_couch_lamp_by_closet_timer”
}
and I keep getting this error - what am I doing wrong?
2022-08-22 17:54:13.828 INFO (MainThread) [homeassistant.components.script.motion_detected] Motion Detected: Running script sequence
2022-08-22 17:54:13.829 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: ‘enablement_input_selector_entity’ is undefined when rendering ‘{{ is_state(enablement_input_selector_entity,‘Enabled’) }}’
2022-08-22 17:54:13.846 WARNING (MainThread) [homeassistant.helpers.script] Error in ‘condition’ evaluation:
In ‘template’ condition: UndefinedError: ‘enablement_input_selector_entity’ is undefined
2022-08-22 17:54:13.853 INFO (MainThread) [homeassistant.components.script.motion_detected] Motion Detected: Test condition template: False