Google Home + IFTTT (MAKER) + HA - Issue, possible quick fix

I’ve been able to do some pretty neat things integrating the three of these applications to work in unison, but I am having trouble with how Google Home interprets command, then how IFTTT (Maker) forwards the request to HA.

Essentially I have coded applets to carry out simple functions in IFTTT, ie.:

Request: Turn off the lamp in the $ | Turn off the $ lamp
Response: Ok, blah blah blah…
URL: http://ip:port/api/services/script/action_turnoff_$lamp (The “$” represents the variable requested. It could be foyer, living room, bed room, nursery, etc…)

The request is interpreted and I receive the response from Google Assistant, but when the request is forwarded to HA, instead of the requesting URL being:
Expected result: http://ip:port/api/services/script/action_turnoff_foyerlamp
Actual result: http://ip:port/api/services/script/action_turnoff_the foyerlamp

Note the addition of the word “the” as well as a space between the words.

Now, I have been able to modify the URL request as it is processed in HA to remove the word “the” and all spaces from the request path for all URL requests containing ‘/api/services/script/’, but I am looking for a more permanent solution as this hack would break with each update as the HA files are replaced.

Does anyone have any ideas on how to make a more permanent solution for this issue? I know I can go back and modify all the scripts I create and add the word “the”, but it would still leave the issue of the space between “the” and the variable.

Thanks

Just thinking out loud here - I haven’t tried this (I use an Alexa skill for this kind of thing).

Scripts within HASS can accept arguments. Perhaps you can do the same with IFTTT? Use one script that’s your IFTTT processing script and look for an incoming payload/argument that you pass in the body field as JSON. Then you can do simple if/then logic in that script and use templates to turn of/off the correct lamp.

HASS can also accept “service_template” so you can have a single script for on and off if you build things correctly.

1 Like

That sounds like a more logical and dynamic option. I’ll have to look into it.

With a newborn, my free time to “tinker” with things is limited.

Can you point me to any documentation or examples for reference?

Over in this thread, you can see some members working on using IFTTT as a presence detector:

Some discussion of passing vars to scripts:

Some discussion of service_template usage:

1 Like