IFTTT HA Not Working

Hi!

I’m trying to get IFTTT working. I’ve seen numerous posts and I have tried everything.

This is my automation yaml

trigger:                                                                                                                                                        
  platform: event                                                                                                                                               
  event_type: ifttt_webhook_received                                                                                                                            
  event_data:                                                                                                                                                   
    action: call_service                                                                                                                                        
action:                                                                                                                                                         
  service: vacuum.send_command                                                                                                                                  
  data: {"entity_id": "vacuum.xiaomi_vacuum_cleaner", "command": "app_goto_target", "params": [[26688,36044]]}

On IFTTT I have this

http://mydomain:8123/api/webhook/<generatedtoken>
content type: json
body
{"entity_id": "vacuum.xiaomi_vacuum_cleaner", "command": "app_goto_target", "params": [[26688,36044]]}

I have tested to see if the vacuum commands work in HA. But I can’t see any indication that IFTTT is working. Any advice would be much appreciated. Thank you!

flyingsubs

Should it be https?

Thanks for the reply, if I make it HTTPS it doesn’t change. Do you think its my DNS? I don’t know if they support HTTPS. I’m using http://freedns.afraid.org/. I guess I could try with duck dns and see.

Tried with Duck DNS and the HTTPS and i’m not getting anything. I’m not seeing any IFTTT logs in HA. Is IFTTT still working with HA? Most likely its on my end.

Here is an example of a working automation trigger where I send a POST message to Home Assistant to trigger an action that is contained in the POST data for an entity that is identified in the POST data:

- id: '1553895680415'
  alias: FromIFTTT
  trigger:
  - event_data:
      action: call_service
    event_type: ifttt_webhook_received
    platform: event
  condition: []
  action:
  - data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
    service_template: '{{ trigger.event.data.service }}'

A couple of things to note about this:

  • This uses the “data template” format to specify inserting variable values that come from the POST data of the http trigger call. This is not allowed in the Automation Editor, so you have to type this into your automations.yaml file. It will show up correctly when you edit the automation in the Automation Editor, but the template part will be shown in red as “invalid”, so don’t attempt to actually edit it there.
  • I started out simpler by just hard-coding the action and entity in the automation using the Automation Editor, and calling the IFTTT webhook with a simple http GET, no POST data included. That worked fine, but I wanted the caller to be able to specify the entity and action.
  • You do have to set up your IFTTT integration first in HA and create a permanent token that IFTTT can use in the call (the one shown as my-private-HA-token below).

The http POST call to trigger this automation this looks like this:

http://external-url-of-my-HA-server/api/webhook/my-private-HA-token
message type POST, POST type: application/json
POST content: { "action": "call service", "service": "input_boolean.turn.on", "entity_id": "input_boolean.switch1" }

Hope that helps.

Your issue may be the same with me.
After update from 0.94 to 096.3, and IFTTT can not working as before… Here are my issue: IFTTT - Automation with unsupported action

Also note that IFTTT was down for a while yesterday as they updated their servers for a new UI. Check the site today to see what the new UI looks like.

It does help! Thank you, I tried your script but still not getting anything from IFTTT. I’m wondering if the connection from IFTTT isn’t working. Any chance you can try it on your system?

I am using my routine regularly to monitor sensors, so I notice very quickly if it goes down.

You need to start with basic diagnostics. There’s no requirement to use a POST request to HA if you aren’t using any POST data. A simple GET works, i.e., an http request you can type into your browser address bar. And the request doesn’t have to actually come from ifttt.com. So you can take IFTTT out of the equation entirely for the moment by just typing the http request to HA into your web browser. If HA responds, then you know the fault is with IFTTT. If not, then either your request isn’t making it to the destination, or the HA webook isn’t set up correctly for IFTTT to call it.

Keep in mind that not every router supports loopback NAT, so you may have to use your HA server’s LAN IP address to call it locally rather than the url you use externally when calling from IFTTT.

Thank you for confirming. I assumed it was definitely on my end. I use Google Wifi, I wonder if it supports loopback NAT. When I have typed it in the search bar I get a forbidden 405 response. I’m thinking of changing directions on this and setting up a schedule on HA. I just need to learn how to always have HA start on boot. Currently working though that. Thank you for all the advice and tips!

If you get a 405 response, that would imply that the request is reaching a destination, but access is denied. If you are typing something like this: “http://internal-ip-of-my-HA-server:8123/api/webhook/my-private-HA-token” into the address bar of your browser and you get a 405 response, are you sure that your IFTTT webhook has been set up and that you wrote the private LLAT (long-lived access token) correctly? You can create a new token or run through the whol setup again if you aren’t sure.

Correction: I am still getting 405 errors going to my hassio instance. Adding my IP address to trusted_networks did help with going to other webservers addressed by my hassio nginx reverse proxy.

Original post:
If you’re trying to use webhooks with a reverse proxy, I’ve found that I get a 405 error until I add this to my trusted_networks:

- !secret myipaddress