Skip to main content

Home Assistant REST command

Config rest command

configuration.yaml
rest_command:
command_name:
url: "https://rest-api-url"
method: post # or get
content_type: "application/x-www-form-urlencoded" # or "application/json"
headers:
Authorization: "auth-token" # if needed

Use rest command to impl Line notify

Make sure you have the Line notify token. Then set up the token in secrets.yaml:

secrets.yaml
line_notify_token: "Bearer your-line-notify-token"

Then add the following to configuration.yaml:

configuration.yaml
rest_command:
line_notify:
url: "https://notify-api.line.me/api/notify"
method: post
content_type: "application/x-www-form-urlencoded"
headers:
Authorization: !secret line_notify_token
payload: "message={{ message }}"

Then you can use the rest_command in your automation:

automation.yaml
rest_command:
line_notify:
url: "https://notify-api.line.me/api/notify?message={{ message }}"
method: post
content_type: "application/x-www-form-urlencoded" # Most be this content type
headers:
Authorization: !secret line_notify_token
info

Reference: Line Notify API

Then finally we are able to send the message through Line notify in home assistant automation: