SMS from Home Assistant, through your own phone
Add Sparetext as a RESTful notifier in configuration.yaml, and any automation can send a text from your own number through your Android phone (or an iPhone with the Mac app), with no USB modem and no SMS provider. A text to that phone can start an automation too, through a webhook trigger.
Send a text from an automation
You need a Sparetext account, a paired phone, and an API key from the API keys page. Home Assistant only has to reach sparetext.dev over HTTPS, so it works the same on Home Assistant OS on a Raspberry Pi, in a VM or in Docker.
- Put the key in secrets.yaml: sparetext_api_key: spt_live_…
- Add the notifier below to configuration.yaml, then restart Home Assistant.
- Try it in Developer tools › Actions: choose notify.sparetext, set a message and your own number as the target, and run it.
# configuration.yaml
notify:
- name: sparetext
platform: rest
resource: https://sparetext.dev/api/v1/messages
method: POST_JSON
headers:
x-api-key: !secret sparetext_api_key
message_param_name: text
target_param_name: toExample: the garage door was left open
Any trigger works: a door, a leak sensor, a freezer's temperature, a printer that ran out of paper. Write the number in E.164, with the country code.
automation:
- alias: "Text me when the garage door is left open"
triggers:
- trigger: state
entity_id: cover.garage_door
to: "open"
for: "00:10:00"
actions:
- action: notify.sparetext
data:
target: "+15550100123"
message: "The garage door has been open for 10 minutes."Start an automation when a text arrives
Sparetext sends each text the phone receives to a webhook, and Home Assistant's webhook trigger turns it into an automation. Home Assistant must be reachable from the internet over HTTPS for this, through Home Assistant Cloud or your own domain, and the trigger needs local_only: false.
A new phone saves only texts from people you've texted, so text the phone once from the number that will send commands, or pick Everyone in the phone's menu on the Phones page.
- Make a long, random webhook ID: Home Assistant treats it like a password.
- In Sparetext, open Webhooks › Add webhook, paste https://YOUR-HOME-ASSISTANT/api/webhook/YOUR-WEBHOOK-ID and keep Text received ticked.
- Add the automation below with the same ID. The text is trigger.json.data.message.text and the sender is trigger.json.data.message.contact.
automation:
- alias: "Porch light by text"
triggers:
- trigger: webhook
webhook_id: "PASTE-YOUR-OWN-LONG-RANDOM-ID"
allowed_methods: [POST]
local_only: false
conditions:
- condition: template
value_template: >
{{ trigger.json.type == 'message.received'
and trigger.json.data.message.contact == '+15550100123'
and trigger.json.data.message.text | lower | trim == 'porch on' }}
actions:
- action: light.turn_on
target:
entity_id: light.porchKeep text commands harmless
Anyone who learns a webhook ID can call it, and a phone number can be spoofed, so check the sender as above and keep texts away from locks, alarms and garage doors, as Home Assistant's own documentation advises. Sparetext signs every webhook, but the webhook trigger can't check signatures; for that, receive the webhook in your own code first (see Receive SMS by webhook).
Why a phone instead of a USB modem
Home Assistant's built-in SMS integration needs a GSM modem plugged into the machine it runs on. With Sparetext the phone you already have sends from your own number over Wi-Fi or mobile data, and the same texts also reach your dashboard, scripts and AI agents.
Questions people ask
- Does it work with Home Assistant OS on a Raspberry Pi?
- Yes. The RESTful notifier is part of Home Assistant, so it works wherever Home Assistant runs, as long as it can reach sparetext.dev over HTTPS.
- How many texts can it send?
- A new API key sends up to 100 texts a day on Free (1,000 on Pro), and Free includes 300 texts a month. Change the key's limit on the API keys page.
- Can one action text several people?
- Home Assistant's REST notifier sends to the first target only. Add one action per person, or use a rest_command that posts a list of numbers as "to".
- Can I use an iPhone?
- Yes, with Sparetext for Mac sending through the iPhone's number, or the iPhone on its own with a Shortcut. An Android phone sends by itself in the background.
Try it on the phone you have
Free for 1 phone and 300 texts a month. An Android pairs in two minutes.