Text Alerts for a Spouse’s Trip Home, Built with Claude
Listen to this article

It’s getting close to dinner, and you’re still guessing when to start cooking because you don’t know when everyone will be home. If you’re the one on the way home, typing out an update at every stop gets old, too.
If that sounds familiar, try building a trip-home alert with Claude.
The idea is for an iPhone to trigger an update when it arrives at or leaves a place you’ve picked. The setup uses past trips and a train timetable to estimate when the person will get home, then sends the estimate by text. That gives whoever’s making dinner a time to work with, even if a train is delayed.
You’ll need an iPhone for the person coming home and a phone that can receive texts. Use Claude to plan the setup and Claude Code to write the program. A Cloudflare Worker does the math online, and a Google script sends the email that signals a delay. You’ll also need the public timetable for the second train on the way home.
I wanted to have dinner ready around the time my wife got home, so I published the part that runs online and tried it three ways with sample times and locations. Setting up her iPhone and testing it on her actual trip home are still ahead. The first step was figuring out where on the route an update would actually help.
Decide where an update would help
I started by thinking about what I’d want to know while getting dinner ready. I gave Claude a list of the messages I wanted, in the order they’d come up on the way home.
- Tell me when she leaves work.
- When she reaches the station where she changes trains, tell me, “I think I’ll be home around [time] today.”
- When she reaches the station closest to home, factor in the walk and tell me, “I’ll be home at [time].”
- If the train is delayed, tell me, “The train is delayed, so I’ll probably be home after [time].” Once it starts moving again, send a new estimate.
I picked SMS because I thought I’d notice a text more quickly than an email. SMS is a short message sent to a phone number.
I also made the setup count leaving work as the start of the trip home only after 3 p.m. and only on days when it knows she arrived at work. That keeps it from sending updates during the morning commute, at lunchtime, or when she goes out on a day off.
If you’re building something similar, list the updates you want and ask Claude, “Draw a diagram of how the whole setup works. Tell me what costs money and what I need to set up on each person’s phone.” That gives you a chance to check the plan before you start.
Send an arrival estimate when the iPhone reaches or leaves a place
Once you know which updates you want, the next step is to have the iPhone trigger them automatically.
On my wife’s iPhone, the setup uses Automation in the Shortcuts app. Think of a sensor at the front door that turns on a light. An automation can tell the iPhone to do a job when she arrives at or leaves a place we’ve picked.
GPS finds the phone’s location, like dropping a pin on a map. When she arrives at or leaves a place we’ve set, such as work or a station, the iPhone tells a small program on the internet.
I put that program in a Cloudflare Worker. Think of a Worker as someone on the internet who does the math. When the iPhone tells it what happened, it works out when she’ll probably get home and returns the text to send.
My wife’s iPhone sends me an SMS only if it gets text back. I use the Worker within its free limits.
Estimate the trip from past timings and the second train’s timetable
Knowing where someone is gives you a starting point. How do you turn that into a time they’ll be home?
For the walk to the station, the wait for the train, and the first train ride, the setup uses the middle value from past trips. Think of lining up the days from shortest to longest for one part of the trip. The time in the middle gives you a rough idea of how long that part takes.
At first there’s no history, so I enter rough times to get started. When she gets home, the setup adds that day’s times and keeps the most recent 30 for each part of the trip.
For the second train, the setup uses the public timetable. It allows time to walk between trains, then picks the train she can catch that gets to the station closest to home earliest.
Once she reaches that last station, the setup uses the average time for the walk home to give a final estimate. At the transfer station, there’s still a train ride and a walk ahead. At the last station, all that’s left is the walk.
Send an update after five minutes without an arrival
Once there’s an estimate, it’s worth deciding what should happen when the trip takes longer than expected.
I set the delay threshold at five minutes past the expected arrival at the next station. If there’s still no arrival update after five minutes, the setup treats the train as delayed. If a walk takes longer, it treats that as a detour.
When the program detects a delay, it sends an email to my wife’s iPhone. An email with the right subject works like ringing a doorbell. The iPhone responds by sending me an SMS.
I used a Google script to send that email. A script is like a written set of instructions for a job. Here, its job is to send the email that gets the iPhone’s attention.
The setup is designed to send a fresh estimate once the train is moving again. It uses whether she’s reached the next station to detect a delay.
Set up an automation for each place on the iPhone
With the calculation and delay updates in place, the remaining step is getting the iPhone to send the signal.
Code is like a set of instructions you hand to a computer. I told Claude Code what I wanted the setup to do and let it write the code. I handled the steps that needed my own account, such as pasting the code that sends the signal email into Google’s editor and publishing it.
The part that works out the arrival time and returns the text is ready. Next, I’ll set up my wife’s iPhone to report where she is and send the messages.
- Use a place as the trigger. Open Shortcuts on the iPhone, go to Automation at the bottom, and tap +. Choose Arrive or Leave and pick the location.
- Set it to run right away. Let it run at any time and choose Run Immediately. Turn off the option that notifies you when it runs.
- Tell the program in the cloud what happened. Use Get Contents of URL to report an arrival or departure. A URL is like an address on the internet. Here, it’s where the iPhone sends its update to the program that does the math.
- Send an SMS if there’s a message to pass on. Use If to check whether any text came back. If it did, use Send Message to send me that text.
- Set up the rest of the locations and the email. Make automations for arriving at and leaving work, the transfer station, the station closest to home, and home itself. Add an email automation to send an SMS when an email with the chosen subject arrives.
All three tests passed with sample times and locations. I tested an on-time trip, a delay on the first train, and a delay on the second. Once my wife’s iPhone is set up, we’ll check on a weekday trip whether the messages come through without her having to do anything.
Get permission before using location data
Because this uses someone’s location, ask them before setting it up and explain what happens at each place. My wife and I already share our locations, and she agreed to this setup too.
Some iPhone automations may ask for confirmation before they run. If the iPhone asks whether to run one, check that Run Immediately is selected. Test it on the actual iPhone to see whether it runs without asking.
Get a fresh copy of the timetable for the second train whenever the schedule changes.
Use the estimate to decide when to start dinner
This could help if you time dinner or a bath around when someone gets home, or if your family wants to spend less time asking, “Where are you now?”
I wanted a better idea of when to start dinner. I also wanted to see what it was like to describe the updates I wanted and connect a few apps to make them happen.
If the texts come through as planned, I’ll have an idea of when my wife will be home without having to ask where she is. An updated estimate after a train delay would give me a better idea of when to start making dinner.




Comments
No comments yet.