Webhooks configuration

Webhooks allow you to send data to your Home Assistant instance via Home Assistant Cloud. You can use these webhooks for example to trigger automations or to send location data with integrations like OwnTracks.

Guides:

Presence detection with OwnTracks

OwnTracks is an application for iOS and Android that allows your phone to report location information securely and directly to Home Assistant. This is used for location-based automations, such as turning up the heat in your home when you leave your workplace.

To set up OwnTracks, follow the procedure described in the OwnTracks integration documentation:

  1. In Home Assistant, under Settings > Devices & services, configure the OwnTracks integration.
    • Take note of the Host URL and the encryption key, you will need it in the next step.
  2. On your device, install the OwnTracks app.
  3. Under Settings > Cloud, you now see a webhook called OwnTracks.
    • You can now use this webhook in an automation.

Triggering an automation with a webhook trigger

This tutorial will show you the following:

  1. How to manually create a webhook.
  2. How to use this webhook in an automation.
  3. We will be able to trigger this automation from anywhere in the world and use the data in the trigger.

To create a webhook trigger and use it in an automation, follow these steps:

  1. To start creating a new automation, go to Settings > Automations & scenes.

    • In the bottom right corner, select Create automation, then, select Create new automation.
  2. Under Trigger, select Webhook.

    • Under Webhook ID, leave the ID as is.
    • Select the cogwheel, and make sure the Only accessible from the local network is cleared (de-selected).
      • This means your webhook is now accessible via cloud. Screenshot of the webhook automation trigger
  3. Under Action, in the Search action field, type “li” and select Light Turn On from the list.

    • In the bottom right corner, select Save.
    • Your automation is now created.
  4. Go to Settings > Cloud and scroll to the webhooks card.

    • You will now see your newly created webhook. Screenshot of the webhooks card in the Cloud panel
  5. Next to the webhook, select Manage.

    • A dialog opens, showing you a unique URL. You can use to this URL to trigger your automation.
    • If you’re on a Linux or Mac, you can test it out with the following commands:
    curl -X POST <the webhook url>
    
    • Form data or JSON data sent to the webhook endpoint will be available to templates in your automation as trigger.data or trigger.json.
    Screenshot of the webhook info dialog

For more information about webhook triggers, refer to the documentation.