NotIf Documentation Pricing App

Home Assistant notifications on your phone

Home Assistant can notify you with NotIf when a door opens, a sensor detects water or the temperature drops. You receive the messages in the Android app, in the browser or in a terminal, with no Nabu Casa account and no companion app.

Create the command

Add a REST command to configuration.yaml, then restart Home Assistant. Replace my-home with a hard-to-guess topic name.

rest_command:
  notif:
    url: "https://usenotif.com"
    method: POST
    content_type: "application/json"
    payload: >
      {{ {
        "topic": "my-home",
        "title": title | default("Home Assistant"),
        "message": message,
        "priority": priority | default(3),
        "tags": tags | default([])
      } | to_json }}

The to_json filter protects accents and quotes in your messages.

Send a message from an automation

Call the rest_command.notif action with the title and the message.

automation:
  - alias: "Garage door open"
    triggers:
      - trigger: state
        entity_id: cover.garage_door
        to: "open"
        for: "00:10:00"
    actions:
      - action: rest_command.notif
        data:
          title: "Garage"
          message: "The garage door has been open for 10 minutes"
          priority: 4
          tags: ["warning"]

In the visual editor, choose Add action → RESTful Command: notif, then switch to YAML mode to fill in data.

Priorities go from 1 to 5. Use 5 for a water leak or an alarm: the Android app vibrates for a long time. See Priorities.

Include a sensor's state

Home Assistant templates work in message.

      - action: rest_command.notif
        data:
          title: "Freezer"
          message: "Temperature: {{ states('sensor.freezer_temperature') }} °C"
          priority: 5
          tags: ["thermometer"]

Reserved topic

Anyone who knows the name of a public topic can read it. For a topic only you can read, reserve it and create a token. Keep the token in secrets.yaml:

notif_auth: "Bearer tk_yourtoken"

Then add the header to the command:

rest_command:
  notif:
    url: "https://usenotif.com"
    method: POST
    content_type: "application/json"
    headers:
      Authorization: !secret notif_auth
    payload: >
      {{ {"topic": "my-home", "title": title | default("Home Assistant"), "message": message} | to_json }}

Act from the notification

A button can call a Home Assistant webhook, for example to close the garage door. The request comes from the phone: it must be able to reach your Home Assistant. By default, Home Assistant only accepts these webhooks from the local network.

      - action: rest_command.notif
        data:
          title: "Garage"
          message: "The door is open"
          actions:
            - action: http
              label: "Close"
              url: "https://ha.example.com/api/webhook/close-garage-8f3k2"
              clear: true

Add "actions": actions | default([]) to the command's payload to pass on the buttons. See Action buttons.