I have the following script:
fanspeed:
sequence:
- service: system_log.write
data_template:
level: info
message: 'Setting fan speed to: ({{speed}})'
From within HomeAssistant Developer Tools SERVICES I can run the following:
Service: script.fanspeed
Service Data (YAML, optional)
1 "speed": "off"
CALL SERVICE
In the log this produces:
[homeassistant.components.system_log.external] Setting fan speed to: (off)
From IFTTT I have the following:
URL: https://<mydomain>.com/api/webhook/<my token>
Method: POST
Content Type: application/json
For the “Body” I have tried all of the following:
{"action": "call_service", "service": "script.fanspeed", "speed": "off" }
{"action": "call_service", "service": "script.fanspeed", { "speed": "off" } }
{"action": "call_service", "service": "script.fanspeed", "data": { "speed": "off"} }
{"action": "call_service", "service": "script.fanspeed", "variables": {"speed": "off" } }
{"action": "call_service", "service": "script.fanspeed", "fields": {"speed": "off" } }
The first two result in the log message:
[homeassistant.components.system_log.external] Setting fan speed to: ()
The rest produce no message (i.e., the script is not called). That is, none of them work!
I am using google assistant to trigger IFTTT, which is working.
Please, can someone tell me what I am to put in the ifttt body field to get it to pass a parameter “speed” to my script?
Thanks!
P.S. I had it working before I upgraded (using the REST api and an api_password) as follows:
url: http://<my domain>.com/api/services/script/fanspeed?api_password=<password>
body: {"speed":"off"}
But I had to convert when I upgraded HA…
P.P.S.
For production I use {{TextField}} but for testing I an using the constant “off”.