Franck Nijhof c464056402
Making our website faster, cleaner and prettier (#9853)
* 🔥 Removes octopress.js

* 🔥 Removes use of root_url var

* 🔥 Removes Octopress generator reference from feed

* 🔥 Removes delicious support

* 🔥 Removes support for Pinboard

* 🔥 Removes support for Disqus

* 🔥 Removes support for Google Plus

* ↩️ Migrate custom after_footer to default template

* ↩️ Migrate custom footer to default template

* ↩️ Migrate custom header to default template

* 🔥 Removes unused template files

* 🚀 Places time to read directly in post template

* 🚀 Removes unneeded capture from archive_post.html template

* 🔥 🚀 Removes unused, but heaving sorting call in component page

* 🚀 Merged javascripts into a single file

* 🔥 Removes more uses of root_url

* 🚀 Removal of unneeded captures from head

* 🔥 🚀 Removal of expensive liquid HTML compressor

* 🔥 Removes unneeded templates

* 🚀 Replaces kramdown with GitHub's CommonMark 🚀

* 💄 Adds Prism code syntax highlighting

*  Adds support for redirect in Netlify

* ↩️ 🔥 Let Netlify handle all developer doc redirects

* ✏️ Fixes typo in redirects file: Netify -> Netlify

* 🔥 Removes unused .themes folder

* 🔥 Removes unused aside.html template

* 🔥 Removes Disqus config leftover

* 🔥 Removes rouge highlighter config

* 🔥 Removes Octopress 🎉

* 💄 Adjust code block font size and adds soft wraps

* 💄 Adds styling for inline code blocks

* 💄 Improve styling of note/warning/info boxes + div support

* 🔨 Rewrites all note/warning/info boxes
2019-07-15 22:17:54 +02:00

5.5 KiB

title, description, logo, ha_category, featured, ha_iot_class, ha_release
title description logo ha_category featured ha_iot_class ha_release
IFTTT Instructions on how to setup IFTTT within Home Assistant. ifttt.png
Automation
true Cloud Push 0.80

IFTTT is a web service that allows users to create chains of simple conditional statements, so-called "Applets". With the IFTTT component, you can trigger applets through the "Webhooks" service (which was previously the "Maker" channel).

Sending events from IFTTT to Home Assistant

To be able to receive events from IFTTT, your Home Assistant instance needs to be accessible from the web (Hass.io instructions) and you need to have the base_url configured for the HTTP integration (docs).

Setting up the integration

To set it up, go to the integrations page in the configuration screen and find IFTTT. Click on configure. Follow the instructions on the screen to configure IFTTT.

Using the incoming data

Events coming in from IFTTT will be available as events in Home Assistant and are fired as ifttt_webhook_received. The data specified in IFTTT will be available as the event data. You can use this event to trigger automations.

For example, set the body of the IFTTT webhook to:

{ "action": "call_service", "service": "light.turn_on", "entity_id": "light.living_room" }

You then need to consume that incoming information with the following automation:

automation:
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{% raw %}{{ trigger.event.data.service }}{% endraw %}'
    data_template:
      entity_id: '{% raw %}{{ trigger.event.data.entity_id }}{% endraw %}'

Sending events to IFTTT

# Example configuration.yaml entry
ifttt:
  key: YOUR_API_KEY

key is your API key which can be obtained by viewing the Settings of the Webhooks applet. It's the last part of the URL (e.g., https://maker.ifttt.com/use/MYAPIKEY) you will find under My Applets > Webhooks > Settings.

Property screen of the Maker Channel

Once you have added your key to your configuration.yaml file, restart your Home Assistant server. This will load up the IFTTT integration and make a service available to trigger events in IFTTT.

After restarting the server, be sure to watch the console for any logging errors that show up in red, white or yellow.

Multiple IFTTT keys

If you have multiple IFTTT users you can specify multiple IFTTT keys with:

# Example configuration.yaml entry
ifttt:
  key: 
    YOUR_KEY_NAME1: YOUR_API_KEY1
    YOUR_KEY_NAME2: YOUR_API_KEY2

Testing your trigger

You can use the Developer tools to test your Webhooks trigger. To do this, open the Home Assistant frontend, open the sidebar, click on the first icon in the developer tools. This should get you to the Call Service screen. Fill in the following values:

Field Value
domain ifttt
service trigger
Service Data {"event": "EventName", "value1": "Hello World"}

When your screen looks like this, click the 'call service' button.

By default the trigger is sent to all the api keys from configuration.yaml. If you want to send the trigger to a specific key use the target field:

Field Value
domain ifttt
service trigger
Service Data {"event": "EventName", "value1": "Hello World", "target": "YOUR_KEY_NAME1"}

The target field can contain a single key name or a list of key names.

Setting up a recipe

Press the New applet button and search for Webhooks.

Choose "Webhooks" as service.

You need to setup a unique trigger for each event you sent to IFTTT.

{% raw %}

# Example configuration.yaml Automation entry
automation:
  alias: Startup Notification
  trigger:
    platform: homeassistant
    event: start
  action:
    service: ifttt.trigger
    data: {"event":"TestHA_Trigger", "value1":"Hello World!"}

{% endraw %}

IFTTT can also be used in scripts and with data_template. Here is the above automation broken into an automation and script using variables and data_templates.

{% raw %}

# Example configuration.yaml Automation entry
automation:
  alias: Startup Notification
  trigger:
    platform: homeassistant
    event: start
  action:
    service: script.ifttt_notify
    data_template:
      value1: 'HA Status:'
      value2: "{{ trigger.event.data.entity_id.split('_')[1] }} is "
      value3: "{{ trigger.event.data.to_state.state }}"

{% endraw %}

{% raw %}

#Example Script to send TestHA_Trigger to IFTTT but with some other data (homeassistant UP).
ifttt_notify:
  sequence:
    - service: ifttt.trigger
      data_template: {"event":"TestHA_Trigger", "value1":"{{ value1 }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"}

{% endraw %}

Additional Channel Examples

Additional examples of using IFTTT channels can be found below.

Channel Description
Manything Automates turning recording ON and OFF based on Home Assistant AWAY and HOME values.