Using Home Assistant automation for parametrized HTTP calls
homeassistant automation

How to use HA automations to run regular HTTP calls with parameters.
October 26, 2023

I've built an API which generates some content that is consumed by other devices. Since this operation is somewhat long-running (~25 seconds) and since devices don't require the freshest content, I wanted to have an automated job that calls the API every 20 minutes.

CRON would be the obvious choice, but as I'm running Home Assistant in my network, I looked at automations as a way to issue these regular HTTP calls.


  1. Repeated schedule - every 20 minutes.
  2. Call an HTTP endpoint using GET with parameters.
  3. Make those parameters configurable in the automation - for different types of devices.


First, I went to configuration.yaml and created new rest_command.

    url: "http://my-ip-address/api/dashboard?force=true&type={{ type }}"
    method: GET

Then I had to restart HA in order for the new service to show up (simply reloading the configuration wasn't enough).

Finally, I went to Automations and created a new automation.

service: rest_command.refresh_paper
  type: homeassistant
alias: Call API for "homeassistant"

This results in Home Assistant calling my API for each type of device every 20 minutes.

Found something inaccurate or plain wrong? Was this content helpful to you? Let me know!