
Home Assistant SMS Notifications via textbee: Setup Guide for Homelab and Personal Infrastructure
Send SMS alerts from Home Assistant through an Android phone. Working rest_command YAML, automations, shell_command and Node-RED alternatives.
TL;DR
- Add one
rest_commandtoconfiguration.yamlthat POSTs tohttps://api.textbee.dev/api/v1/gateway/send-smswith your API key fromsecrets.yaml, then callrest_command.send_smsfrom any automation. That is the whole integration. - textbee sends through a linked Android phone and its SIM, so there is no cloud SMS account and no per-message API fee.
- Keep the API key in
secrets.yamland never commit it. - SMS should be sparse and actionable: security events, power and internet failures, water leaks. Not temperature polling.
- Use a dedicated spare Android on a charger rather than your daily phone. Device uptime is your alert uptime.
Home automation eventually needs one channel that still works when the internet is weird, phones are on Do Not Disturb, or a family member needs an alert without installing another app. SMS is a blunt, reliable signal, as long as you keep it sparse and actionable.
textbee sends SMS through a linked Android phone's SIM. Home Assistant calls the textbee REST API, textbee relays the command to the phone, and the phone dispatches the message over cellular. No CPaaS account, no rented number, no per-message API fee.
This guide assumes you run Home Assistant (Core, OS, or Container) and are comfortable editing YAML. If textbee is new to you, run the quickstart first and confirm a successful send from curl before touching HA config. If you want the gateway itself on your own hardware, see self-hosting an open source SMS gateway.
When is SMS the right notification channel?
Use SMS for events that need a person to act, and where a push notification might not land: security, infrastructure failure, and household emergencies. Everything else belongs on push, email, or a dashboard. The discipline matters, because a channel that cries wolf gets ignored exactly when it counts.
Good candidates:
- Security: alarm armed or disarmed unexpectedly, door opened at 3am, motion outside.
- Infrastructure: internet down, UPS on battery, NAS offline.
- Emergencies: water leak, smoke or CO detector, freezer above threshold.
- Coordination: garage left open, package delivered. Low stakes, time sensitive.
Avoid SMS for chatty sensors, anything a push notification already covers, and anything needing a graph or an image.
Architecture
Home Assistant automation
-> rest_command action call
-> textbee REST API (api.textbee.dev)
-> Android device with SIM
-> carrier network
-> recipient's phoneThe Android device does not need to be on the same network as Home Assistant. It needs internet access, and textbee relays the send command to it. That distinction matters later, when the internet is the thing that failed.
Step 1: add the rest_command
Add this to configuration.yaml, or to a split rest_commands.yaml if you use packages:
rest_command:
send_sms:
url: "https://api.textbee.dev/api/v1/gateway/send-sms"
method: POST
headers:
x-api-key: !secret textbee_api_key
payload: '{"recipients": ["{{ recipient }}"], "message": "{{ message }}"}'
content_type: "application/json"That defines a reusable action, rest_command.send_sms, taking two variables: recipient and message.
textbee picks the sending device for you: your default device, or the enabled device with the most recent heartbeat. If you run more than one phone and want to pin the send, add "deviceId": "{{ device_id }}" to the payload and pass a third variable. A malformed device id fails the request rather than silently sending from another phone, which is the behaviour you want in an alerting path.
url, method, headers, payload, and content_type are all standard rest_command keys. timeout defaults to 10 seconds and is worth raising only if your HA box has a slow uplink.
Step 2: store credentials in secrets.yaml
Never put the API key in configuration.yaml:
# secrets.yaml
textbee_api_key: "your-api-key-here"
textbee_device_id: "your-device-id-here"If you use the Home Assistant UI secrets manager (Settings, System, Secrets), add textbee_api_key there. It writes to the same file.
Step 3: write your first automation
This sends an SMS when the front door opens between 10pm and 6am:
automation:
- alias: "SMS alert: front door opened at night"
triggers:
- trigger: state
entity_id: binary_sensor.front_door
to: "on"
conditions:
- condition: time
after: "22:00:00"
before: "06:00:00"
actions:
- action: rest_command.send_sms
data:
recipient: "+15550100142"
message: "HA: Front door opened at {{ now().strftime('%H:%M') }}. Check camera."Two syntax notes. Current Home Assistant uses the plural triggers, conditions, and actions keys, with trigger: inside a trigger and action: inside an action. The older platform: and service: spelling still works, so an existing automation does not need rewriting. And {{ now().strftime('%H:%M') }} puts the time in the message, which is the difference between an alert you can act on and one you have to go look up.
More automation examples
Water leak
automation:
- alias: "SMS alert: water leak detected"
triggers:
- trigger: state
entity_id: binary_sensor.basement_water_sensor
to: "on"
actions:
- action: rest_command.send_sms
data:
recipient: "+15550100142"
message: "HA: WATER LEAK, basement sensor. Check immediately."UPS on battery
automation:
- alias: "SMS alert: UPS on battery"
triggers:
- trigger: state
entity_id: sensor.ups_status
to: "OB" # OB is the NUT status for On Battery
actions:
- action: rest_command.send_sms
data:
recipient: "+15550100142"
message: >-
HA: UPS on battery. Utility feed lost.
Battery {{ states('sensor.ups_battery_charge') }}%,
{{ states('sensor.ups_runtime') }} min runtime.NAS or server offline
automation:
- alias: "SMS alert: NAS offline"
triggers:
- trigger: state
entity_id: binary_sensor.nas_ping
to: "off"
for:
minutes: 3
actions:
- action: rest_command.send_sms
data:
recipient: "+15550100142"
message: "HA: NAS unreachable 3+ minutes. Check network and power."The for: guard is what keeps a brief network hiccup from waking you up.
The shell_command alternative
If you would rather shell out, shell_command works:
shell_command:
send_sms_curl: >-
curl -s -X POST https://api.textbee.dev/api/v1/gateway/send-sms
-H "x-api-key: {{ api_key }}"
-H "Content-Type: application/json"
-d '{"recipients": ["{{ recipient }}"], "message": "{{ message }}"}'Three things to know before you use it. Templated shell_command entries run without a shell, so no pipes, no redirects, and no ~ expansion. Only the part after the first space can come from a template, so the command name has to be literal (it is, here). And templates cannot read secrets.yaml, so the API key has to arrive as action data, which puts it in automation traces.
That last point is the reason to prefer rest_command. It takes !secret directly, reports success or failure back to Home Assistant, and does not spawn a process per alert. Reach for shell_command only when you need something curl can do and rest_command cannot.
The Node-RED alternative
If you already run Node-RED next to Home Assistant, the HTTP Request node is easier than YAML for branching logic. Build the request in a function node first, then send it:
msg.method = 'POST'
msg.url = 'https://api.textbee.dev/api/v1/gateway/send-sms'
msg.headers = {
'x-api-key': env.get('TEXTBEE_API_KEY'),
'Content-Type': 'application/json',
}
msg.payload = {
recipients: ['+15550100142'],
message: `HA: ${msg.alertText}`,
}
return msgWire that into an HTTP Request node with the method and URL left blank so msg.method and msg.url win, and set Return to "a parsed JSON object". Upstream, an events-state node from the Home Assistant palette plus a switch node filters which events are worth an SMS. Keep the key in a Node-RED environment variable rather than typing it into the node.
The same shape works from any workflow tool that can make an HTTP request, which is how n8n automations call textbee too.
Writing alert messages people can act on
A single SMS segment is 160 GSM-7 characters, and that constraint is a feature. Write what happened, where, and what to do. Good:
HA: WATER LEAK, basement. Check immediately.
HA: Front door opened 03:14. Camera in the app.
HA: UPS on battery. 12 min runtime left.
HA: Freezer at 28F, above threshold. Check the door seal.
HA: Garage open 45+ min. Close from the app if safe.Bad:
sensor.lumi_water_basement changed from dry to wet at 2026-10-27T03:14:22.413+00:00
automation triggered: water_leak_detectedThe bad ones dump raw event data. Nobody parses that at 3am. Long messages also split into multiple segments and count as multiple sends, so brevity is cheaper as well as clearer.
Reliability for homelab use
Use a dedicated spare Android. Your daily phone dying at 2% or rebooting for an update mid-alert is a reliability problem you do not need. Any cheap secondhand Android on a charger on a shelf is the right answer.
Keep it plugged in and awake. Battery cycling matters less than uptime. Disable OEM battery optimization for the textbee app, which is the single most common cause of alerts that stop arriving. If sends start stalling or arriving in bursts when the screen wakes, that is the symptom. Set textbee to Unrestricted under Settings, Battery, as the setup guide shows, and check the OEM's own app killer (Samsung's sleeping apps list, Xiaomi's autostart) as well.
Understand your network path. The phone reaches textbee over the internet. If your broadband is down and the phone is on Wi-Fi only, your alerts are down at the exact moment you want them. Give the gateway phone a data SIM so it keeps working on cellular. On a Raspberry Pi or small Linux box, the same logic applies to whatever hosts Home Assistant, and the Pi gateway guide covers that side.
Recheck permissions after OS updates. SEND_SMS occasionally needs regranting after a major Android upgrade. If alerts stop the week after an update, check there first.
Test monthly. Add an automation that fires on a schedule and sends "HA: monthly test, system OK". An alerting path you have not exercised in six months is not an alerting path.
Frequently asked questions
Does Home Assistant have a native textbee integration?
No, and it does not need one. rest_command is a first-class Home Assistant pattern and is how most custom HTTP integrations are wired up. There is no HACS component to install, and nothing to break on an HA upgrade beyond the YAML you wrote yourself.
Can I send SMS when my internet is down?
Only if the Android device has its own mobile data. A phone on Wi-Fi only cannot reach the textbee API during an outage. A device with a data SIM keeps working when the broadband link dies, which is what makes it a genuine last-resort channel rather than another thing that fails with everything else.
How do I send to multiple people?
Pass an array. The API accepts several recipients in one call, and each one is billed as one message:
payload: '{"recipients": ["+15550100142", "+15550100143"], "message": "{{ message }}"}'For different recipients per alert, define one rest_command per group, or template the whole array and pass it in as a variable.
Can I receive SMS replies back into Home Assistant?
Yes. Create a webhook in the textbee dashboard under Webhooks, subscribe it to MESSAGE_RECEIVED, and point it at a Home Assistant webhook trigger URL. Incoming SMS then POST to HA in real time and you can branch on the body, for example a "STOP" reply that silences a noisy sensor. The URL must be public HTTPS, since private and loopback hosts are rejected. See the webhooks docs for payload shape and signature verification.
How many SMS can I send per day?
More than a homelab will ever need. Throughput is bounded by the phone and its carrier, so plan on hundreds to low thousands per day per device, spread out rather than bursted. Alerting traffic is a handful of messages a day, nowhere near that. Check your plan's message allowance on the pricing page if you also use the account for something busier.
Get started
- Create a textbee account and link a spare Android phone.
- Download the Android app.
- Run the quickstart and confirm a send from curl.
- Add the
rest_commandabove, restart Home Assistant, and test it from Developer Tools before wiring it into an automation.
Stuck? [email protected]
Get more textbee in Google Search
Add textbee.dev as a preferred source. Our posts show up more often in your Google results.
You may also like

SMS Gateway for Raspberry Pi and Linux Servers: Alerts via Your Android Phone
Send SMS alerts from a Raspberry Pi or Linux server using textbee and an Android phone as the gateway. Python scripts, bash/curl one-liners, systemd services, and Uptime Kuma webhook config.

Open Source SMS Gateway: Self-Host Your Own with an Android Phone (2026)
textbee is an open source (AGPLv3), self-hostable SMS gateway. What open source means here, self-hosted vs managed, how to run it with Docker Compose, and how it compares with Gammu and other Android gateways.

n8n SMS Integration with textbee: Automate SMS Without Code
Send SMS from n8n workflows using textbee and your Android phone as the gateway. HTTP Request node config, workflow patterns, expressions, and a full open-source self-hosted stack guide.